-
Notifications
You must be signed in to change notification settings - Fork 277
joelpx edited this page Nov 27, 2016
·
6 revisions
WARNING: the API should be changed in the future.
The variable api
is accessible from the python interactive console.
$ plasma -i tests/server.bin
>> py
help(api)
You can also run scripts with the command py
.
Save this script to test_api.py
:
ep = api.entry_point()
print("analyze entry point:", api.get_symbol(ep))
api.set_code(ep)
ad = api.get_addr_from_symbol("main")
for x in api.xrefsto(ad):
print("xref to main(0x%x):" % ad, hex(x))
insn = api.disasm(ad)
print("first instruction of main:", insn.mnemonic, insn.op_str)
Now run the script. Note: here we don't run the auto-analyzer with the option -na just to test the function api.set_code
.
$ plasma -i -na tests/server.bin
>> py test_api.py
analyze entry point: _start
xref to main(0x4009c6): 0x4008ed
first instruction of main: push rbp