diff options
| author | serpilliere <devnull@localhost> | 2014-06-03 10:27:56 +0200 |
|---|---|---|
| committer | serpilliere <devnull@localhost> | 2014-06-03 10:27:56 +0200 |
| commit | ed5c3668cc9f545b52674ad699fc2b0ed1ccb575 (patch) | |
| tree | 07faf97d7e4d083173a1f7e1bfd249baed2d74f9 /example/disasm_03.py | |
| parent | a183e1ebd525453710306695daa8c410fd0cb2af (diff) | |
| download | miasm-ed5c3668cc9f545b52674ad699fc2b0ed1ccb575.tar.gz miasm-ed5c3668cc9f545b52674ad699fc2b0ed1ccb575.zip | |
Miasm v2
* API has changed, so old scripts need updates * See example for API usage * Use tcc or llvm for jit emulation * Go to test and run test_all.py to check install Enjoy !
Diffstat (limited to 'example/disasm_03.py')
| -rw-r--r-- | example/disasm_03.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/example/disasm_03.py b/example/disasm_03.py new file mode 100644 index 00000000..08b209a1 --- /dev/null +++ b/example/disasm_03.py @@ -0,0 +1,23 @@ +import sys +from elfesteem import pe_init +from miasm2.arch.x86.disasm import dis_x86_32 +from miasm2.core.asmbloc import bloc2graph +from miasm2.core.bin_stream import bin_stream_pe + +if len(sys.argv) != 3: + print 'Example:' + print "%s box_upx.exe 0x410f90" % sys.argv[0] + sys.exit(0) + +fname = sys.argv[1] +ad = int(sys.argv[2], 16) +e = pe_init.PE(open(fname).read()) +bs = bin_stream_pe(e.virt) + +mdis = dis_x86_32(bs) +# inform the engine not to disasm nul instructions +mdis.dont_dis_nulstart_bloc = True +blocs = mdis.dis_multibloc(ad) + +g = bloc2graph(blocs) +open('graph.txt', 'w').write(g) |