about summary refs log tree commit diff stats
path: root/example/unpack_upx.py
diff options
context:
space:
mode:
authorserpilliere <devnull@localhost>2013-03-11 14:26:11 +0100
committerserpilliere <devnull@localhost>2013-03-11 14:26:11 +0100
commit201c103ad115317ccc026ba47c6c0ec65d9dd0d1 (patch)
tree3aa1f4c883a86ba6e4bb2838f77b5d6a28592f11 /example/unpack_upx.py
parentd78bee144a4c0ba0c9dc1352aa19ef8e557226ed (diff)
downloadmiasm-201c103ad115317ccc026ba47c6c0ec65d9dd0d1.tar.gz
miasm-201c103ad115317ccc026ba47c6c0ec65d9dd0d1.zip
fix upx with dll
Diffstat (limited to 'example/unpack_upx.py')
-rw-r--r--example/unpack_upx.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/example/unpack_upx.py b/example/unpack_upx.py
index 17960ea6..34da5ce8 100644
--- a/example/unpack_upx.py
+++ b/example/unpack_upx.py
@@ -27,6 +27,8 @@ init_code_bloc_pool_py()
 

 codenat_tcc_init()

 

+print "start emul..."

+machine = x86_machine()

 

 

 job_done = set()

@@ -34,17 +36,17 @@ symbol_pool = asmbloc.asm_symbol_pool()
 if e.Coffhdr.characteristics & (1<<13):

     # dll

     all_bloc = asmbloc.dis_bloc_all(x86_mn, in_str, decomp_func, job_done, symbol_pool, bloc_wd=2)

+    f_eip = emul_bloc(machine, all_bloc[0])

+    f_eip = emul_bloc(machine, all_bloc[1])

+

     b = all_bloc[1]

 else:

     # binary

     all_bloc = asmbloc.dis_bloc_all(x86_mn, in_str, decomp_func, job_done, symbol_pool, bloc_wd=1)

-    b = all_bloc[0]

-print b

+    f_eip = emul_bloc(machine, all_bloc[0])

 

 

-print "start emul..."

-machine = x86_machine()

-f_eip = emul_bloc(machine, b)

+#f_eip = emul_bloc(machine, b)

 

 decomp_buf_ad_in =  int(machine.pool[esi].arg)

 decomp_buf_ad_out = int( machine.pool[edi].arg)

@@ -273,4 +275,5 @@ print repr(e.SHList)
 e.DirImport.set_rva(s_myimp.addr)

 

 e.Opthdr.AddressOfEntryPoint = e.virt2rva(end_label)

-open('out.bin','w').write(str(e))

+fname = fname.replace('.', '_')

+open(fname+'_unupx.bin','w').write(str(e))