diff options
| author | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2014-10-08 17:59:45 +0200 |
|---|---|---|
| committer | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2014-10-08 17:59:45 +0200 |
| commit | 2f4d1bf249f09b17c85f78bb9d2cbdec60b5be45 (patch) | |
| tree | 4947690040f000b8ac582c9e76e8b084001f740d /example/asm_mips32.py | |
| parent | faae3a839c34c49cd26a0665c9e646f1a5127784 (diff) | |
| download | miasm-2f4d1bf249f09b17c85f78bb9d2cbdec60b5be45.tar.gz miasm-2f4d1bf249f09b17c85f78bb9d2cbdec60b5be45.zip | |
asmbloc: remove un needed mode in asm function
Diffstat (limited to 'example/asm_mips32.py')
| -rw-r--r-- | example/asm_mips32.py | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/example/asm_mips32.py b/example/asm_mips32.py index 83e7a90b..aec57886 100644 --- a/example/asm_mips32.py +++ b/example/asm_mips32.py @@ -25,9 +25,10 @@ my_var_parser = parse_ast(my_ast_id2expr, my_ast_int2expr) base_expr.setParseAction(my_var_parser) -st = StrPatchwork() +st_l = StrPatchwork() +st_b = StrPatchwork() -blocs, symbol_pool = parse_asm.parse_txt(mn_mips32, "l", ''' +txt = ''' main: ADDIU A0, ZERO, 0x10 ADDIU A1, ZERO, 0 @@ -40,19 +41,29 @@ loop: MOVN A1, ZERO, ZERO JR RA ADDIU A2, A2, 0x1 -''') +''' + +blocs_b, symbol_pool_b = parse_asm.parse_txt(mn_mips32, "b", txt) +blocs_l, symbol_pool_l = parse_asm.parse_txt(mn_mips32, "l", txt) # fix shellcode addr -symbol_pool.set_offset(symbol_pool.getby_name("main"), 0) +symbol_pool_b.set_offset(symbol_pool_b.getby_name("main"), 0) +symbol_pool_l.set_offset(symbol_pool_l.getby_name("main"), 0) -for b in blocs[0]: +for b in blocs_b[0]: print b -resolved_b, patches = asmbloc.asm_resolve_final( - mn_mips32, 'l', blocs[0], symbol_pool) -print patches +resolved_b, patches_b = asmbloc.asm_resolve_final( + mn_mips32, blocs_b[0], symbol_pool_b) +resolved_l, patches_l = asmbloc.asm_resolve_final( + mn_mips32, blocs_l[0], symbol_pool_l) +print patches_b +print patches_l -for offset, raw in patches.items(): - st[offset] = raw +for offset, raw in patches_b.items(): + st_b[offset] = raw +for offset, raw in patches_l.items(): + st_l[offset] = raw -open('mips32_sc.bin', 'wb').write(str(st)) +open('mips32_sc_b.bin', 'wb').write(str(st_l)) +open('mips32_sc_l.bin', 'wb').write(str(st_l)) |