-
Notifications
You must be signed in to change notification settings - Fork 65
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
No examples #10
Comments
Hi Zach, Indeed, I need to add examples from the tests/ directory but its currently To answer your question, it depends on the input you provide. If amoco has first import necessary stuff:
Now, assuming you are analyzing 'example.exe' binary,
which loads the binary in amoco's memory model, and creates a linear sweep
to retreive the basic block, and if you want to analyze only the first 3
Now b.map holds a mapper object that captures symbolically the "execution" If you want to only provide the sequence as a "shellcode" Python string, Assuming its x86 for example you would do:
Now that we have the block object to be studied lets proceed with Let's assume that we have:
Since you are in a debugger you have indeed access to "concrete" values so
for example here I assume that the state before executing/simulating b Now if I do:
Note that all "values" are of type amoco.cas.expressions.cst so if you want
If you are now fetching some new instructions based on s(p.cpu.eip) as a
Thats for a start :) don't hesitate if you have more questions ! Thanks, On Mon, May 18, 2015 at 11:44 PM, Zach Riggle [email protected]
|
Is there a way to provide a hook for memory access? I won't know ahead of time all of the addresses which Amoco will need to look up. |
If I understand well, you'd like to provide an interface to a concrete state to a mapper and get the resulting mapper where all (or some) symbolic values have been replaced by their concrete value (cst objects) in the provided state interface. Good idea... To implement this, I would rely on the eval method already found in all cas.expressions classes and would just implement a new "concrete mapper" as env argument which rather than evaluating the expression in the usual amoco.cas.mapper.mapper class would evaluate the expression out of the gdb state. I will implement the skeleton of cmapper based on this idea so that you'd only need to implement the extraction of concrete values out of the gdb/whatever state. stay tuned |
Yeah, basically this allows use as an emulator instead of a strictly symbolic solver. |
I've added a 'csi' attribute directly in the mapper class which (if set) acts as a hook function to implement a concrete state interface. I'll still need to document this with examples but here is the idea : you define your own function that takes a amoco expression as input |
This seems like a really great project with a lot of potential uses. For one, I'd like to use it in my pwndbg debugger scripts for GDB in order to simulate execution of a single basic block (to determine the expected path of a conditional branch).
Unfortunately, there do not appear to be any examples which I can base this work off of. Since I'm running in a debugger, I can provide complete state information, and even memory access.
How would I go about simulating a short sequence of instructions, given a known starting register context?
The text was updated successfully, but these errors were encountered: