From 22777cc19e6e1f43fbbfb908e5d4d4cd7c76b391 Mon Sep 17 00:00:00 2001 From: Fabrice Desclaux Date: Fri, 27 Mar 2015 14:22:52 +0100 Subject: Asmbloc: updt asmbloc api --- test/arch/x86/unit/asm_test.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'test/arch/x86/unit/asm_test.py') diff --git a/test/arch/x86/unit/asm_test.py b/test/arch/x86/unit/asm_test.py index f28c4d2f..b65ef876 100644 --- a/test/arch/x86/unit/asm_test.py +++ b/test/arch/x86/unit/asm_test.py @@ -53,8 +53,7 @@ class Asm_Test(object): # fix shellcode addr symbol_pool.set_offset(symbol_pool.getby_name("main"), 0x0) s = StrPatchwork() - resolved_b, patches = asmbloc.asm_resolve_final( - mn_x86, blocs[0], symbol_pool) + patches = asmbloc.asm_resolve_final(mn_x86, blocs[0], symbol_pool) for offset, raw in patches.items(): s[offset] = raw -- cgit 1.4.1 From f9c49e92dada2aa51ca594f435f962617796c116 Mon Sep 17 00:00:00 2001 From: Fabrice Desclaux Date: Fri, 27 Mar 2015 14:31:24 +0100 Subject: Clean: remove unecessary ast_parser modification --- example/asm/shellcode.py | 9 --------- example/expression/asm_to_ir.py | 7 ------- test/arch/x86/unit/asm_test.py | 12 ------------ 3 files changed, 28 deletions(-) (limited to 'test/arch/x86/unit/asm_test.py') diff --git a/example/asm/shellcode.py b/example/asm/shellcode.py index 7bf76093..3b22e801 100644 --- a/example/asm/shellcode.py +++ b/example/asm/shellcode.py @@ -58,15 +58,6 @@ else: virt = st output = st -# Fix the AST parser -def my_ast_int2expr(a): - return m2_expr.ExprInt_fromsize(size, a) - -def my_ast_id2expr(t): - return reg_and_id.get(t, m2_expr.ExprId(t, size=size)) - -my_var_parser = parse_ast(my_ast_id2expr, my_ast_int2expr) -base_expr.setParseAction(my_var_parser) # Get and parse the source code with open(args.source) as fstream: diff --git a/example/expression/asm_to_ir.py b/example/expression/asm_to_ir.py index ccb7202e..942e5e19 100644 --- a/example/expression/asm_to_ir.py +++ b/example/expression/asm_to_ir.py @@ -7,13 +7,6 @@ from miasm2.arch.x86.ira import ir_a_x86_32 from pdb import pm -def my_ast_int2expr(a): - return ExprInt32(a) - -my_var_parser = parse_ast(ast_id2expr, my_ast_int2expr) -base_expr.setParseAction(my_var_parser) - - # First, asm code blocs, symbol_pool = parse_asm.parse_txt(mn_x86, 32, ''' main: diff --git a/test/arch/x86/unit/asm_test.py b/test/arch/x86/unit/asm_test.py index b65ef876..c6381d9e 100644 --- a/test/arch/x86/unit/asm_test.py +++ b/test/arch/x86/unit/asm_test.py @@ -20,18 +20,6 @@ if filename and os.path.isfile(filename): reg_and_id = dict(mn_x86.regs.all_regs_ids_byname) - -def my_ast_int2expr(a): - return ExprInt32(a) - - -def my_ast_id2expr(t): - return reg_and_id.get(t, ExprId(t, size=32)) - -my_var_parser = parse_ast(my_ast_id2expr, my_ast_int2expr) -base_expr.setParseAction(my_var_parser) - - class Asm_Test(object): def __init__(self): self.myjit = Machine("x86_32").jitter() -- cgit 1.4.1