From 3092083d970a1566e31d65670117150f004692fe Mon Sep 17 00:00:00 2001 From: serpilliere Date: Mon, 14 Nov 2011 20:14:06 +0100 Subject: add symbol renaming; save to file --- example/disas_and_graph.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'example') diff --git a/example/disas_and_graph.py b/example/disas_and_graph.py index f7b0fa60..8a41d979 100755 --- a/example/disas_and_graph.py +++ b/example/disas_and_graph.py @@ -38,6 +38,8 @@ parser.add_option('-c', "--followcall", dest="followcall", action="store_true", parser.add_option('-n', "--dontdiscallret", dest="dontdiscallret", action="store_true", default=False, metavar=None, help="dont disasssemble call next instruction") +parser.add_option('-l', "--loadstate", dest="load_state_file", default = None, + help="load state file") (options, args) = parser.parse_args(sys.argv[1:]) @@ -194,4 +196,6 @@ def my_disasm_callback(ad): l.set_args_symbols(o) return all_bloc -graph_blocs(ad_to_dis, all_bloc = [], dis_callback = my_disasm_callback) +graph_blocs(ad_to_dis, symbol_pool, all_bloc = [], + dis_callback = my_disasm_callback, + load_state_file = options.load_state_file) -- cgit 1.4.1 From 3b59992ee155518276ebf366880c967b5efdf5bf Mon Sep 17 00:00:00 2001 From: serpilliere Date: Wed, 16 Nov 2011 22:18:25 +0100 Subject: use elf entry point if no main --- example/sandbox_elf.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'example') diff --git a/example/sandbox_elf.py b/example/sandbox_elf.py index f8e308e2..dc4aa5df 100644 --- a/example/sandbox_elf.py +++ b/example/sandbox_elf.py @@ -41,8 +41,10 @@ vm_add_memory_page(stack_base_ad, PAGE_READ|PAGE_WRITE, "\x00"*stack_size) dump_memory_page_pool_py() - -ep = e.sh.symtab.symbols['main'].value +try: + ep = e.sh.symtab.symbols['main'].value +except: + ep = e.Ehdr.entry ptr_esp = stack_base_ad+stack_size-0x1000 vm_set_mem(ptr_esp, "/home/toto\x00") @@ -72,7 +74,7 @@ known_blocs = {} code_blocs_mem_range = [] -log_regs = False +log_regs = True log_mn = log_regs must_stop = False def run_bin(my_eip, known_blocs, code_blocs_mem_range): -- cgit 1.4.1 From 10149e4e7ebff93b4cef05700a7db9ef95df1167 Mon Sep 17 00:00:00 2001 From: serpilliere Date: Thu, 17 Nov 2011 22:02:29 +0100 Subject: fix uncomplete graph pos --- example/sandbox_pe.py | 4 +--- miasm/graph/graph_qt.py | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'example') diff --git a/example/sandbox_pe.py b/example/sandbox_pe.py index 75e9b306..fe3aa390 100644 --- a/example/sandbox_pe.py +++ b/example/sandbox_pe.py @@ -90,7 +90,7 @@ log_regs = True log_mn = log_regs def run_bin(my_eip, known_blocs, code_blocs_mem_range): global log_regs, log_mn - while my_eip != 0x1337beef: + while my_eip != 0x1337beef: #dyn dll funcs if my_eip in runtime_dll.fad2cname: @@ -120,9 +120,7 @@ def run_bin(my_eip, known_blocs, code_blocs_mem_range): known_blocs, code_blocs_mem_range = updt_automod_code(known_blocs) else: raise ValueError("except at", hex(my_eip)) - - print "start emulation" run_bin(ep, known_blocs, code_blocs_mem_range) dump_raw_e(e) diff --git a/miasm/graph/graph_qt.py b/miasm/graph/graph_qt.py index 1f806076..adb4fe50 100755 --- a/miasm/graph/graph_qt.py +++ b/miasm/graph/graph_qt.py @@ -955,6 +955,9 @@ class MainWindow(QtGui.QWidget): txt = txt.replace('\t', ' '*4) e = node_asm_bb(txt, self) e.h = MyHighlighter(e) + if not "g_pos" in b.__dict__: + print "WARNING: unset bloc pos", b.label + continue e.setpos(*b.g_pos) wproxy = self.scene.addWidget(e) self.scene_blocs.append(wproxy) -- cgit 1.4.1