Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DbgValFromString&DbgEval #2223

Closed
Paliha opened this issue Oct 9, 2019 · 6 comments
Closed

DbgValFromString&DbgEval #2223

Paliha opened this issue Oct 9, 2019 · 6 comments
Labels
question The issue is a question.

Comments

@Paliha
Copy link

Paliha commented Oct 9, 2019

Hi!
What method can I get data from a variable in a script?
Example from the script:
FindPointer mytable, pattern, 4
The method that I use:
bool cbFunctionFindPointer(int argc, char* argv[3])
{
char buffer[MAX_MNEMONIC_SIZE];
bool success;
duint index = DbgEval(argv[1], &success);
duint Size = Memory::GetSize(DbgValFromString(argv[1]), false, true);
.....
}
Unfortunately, there are no data in the variables. As a result, the functions (DbgValFromString&DbgEval) simply convert the variable name to unsigned __int64:
0x0000020db33b9720 {0x0000020db33b72f0 "FindPointer mytable, pattern, 4"}
index = 5557833728 //unsigned __int64
Size = 1077248 //unsigned __int64

@mrexodia
Copy link
Member

Hi, can't you just use findallmem from your script? findallmem 0, "{bswap@mytable}" should work. Otherwise could you paste the full code because right now it does not make any sense to me.

@mrexodia mrexodia added the question The issue is a question. label Oct 12, 2019
@Paliha
Copy link
Author

Paliha commented Oct 13, 2019

if my memory serves me, this command displays the search result in the ref window. This is not convenient. To search for va / rva pointers, I wrote my command and everything was in order. With the transition to a fresh OS (vin10.1809) in place of the arguments, I get a line with the command and variables.

@mrexodia
Copy link
Member

mrexodia commented Oct 13, 2019 via email

@mrexodia
Copy link
Member

It might help to try

bool cbListArguments(int argc, char* argv[])
{
    for(int i = 0; i < argc; i++) dprintf("%d:%s\n", i, argv[i]);
    return true;
}

And see what is the output.

@Paliha
Copy link
Author

Paliha commented Oct 19, 2019

for(int i = 0; i < argc; i++) dprintf("%d:%s\n", i, argv[i]);
the output is the same variables.


updated sdk, added to method:
sprintf(buffer, "%p", DbgValFromString(argv[2]));
strncpy_s(buffer, buffer, len);
now everything is great..))

@mrexodia
Copy link
Member

I have no idea what the issue was. The code you sent earlier looked fine 🤷‍♂ but glad you fixed it :) Feel free to close the issue if it’s solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question The issue is a question.
Projects
None yet
Development

No branches or pull requests

3 participants