diff options
Diffstat (limited to 'example')
| -rw-r--r-- | example/expression/basic_simplification.py | 2 | ||||
| -rw-r--r-- | example/expression/expr_grapher.py | 2 | ||||
| -rw-r--r-- | example/expression/simplification_tools.py | 12 | ||||
| -rw-r--r-- | example/expression/solve_condition_stp.py | 3 | ||||
| -rw-r--r-- | example/symbol_exec/depgraph.py | 4 |
5 files changed, 12 insertions, 11 deletions
diff --git a/example/expression/basic_simplification.py b/example/expression/basic_simplification.py index 17b1a35b..ef904686 100644 --- a/example/expression/basic_simplification.py +++ b/example/expression/basic_simplification.py @@ -10,7 +10,7 @@ a = ExprId('eax') b = ExprId('ebx') exprs = [a + b - a, - ExprInt32(0x12) + ExprInt32(0x30) - a, + ExprInt(0x12, 32) + ExprInt(0x30, 32) - a, ExprCompose(a[:8], a[8:16])] for e in exprs: diff --git a/example/expression/expr_grapher.py b/example/expression/expr_grapher.py index 3137e6d2..0de2142b 100644 --- a/example/expression/expr_grapher.py +++ b/example/expression/expr_grapher.py @@ -9,7 +9,7 @@ d = ExprId("D") m = ExprMem(a + b + c + a) e1 = ExprCompose(a + b - (c * a) / m | b, a + m) -e2 = ExprInt64(15) +e2 = ExprInt(15, 64) e = ExprCond(d, e1, e2)[0:32] print "[+] Expression:" diff --git a/example/expression/simplification_tools.py b/example/expression/simplification_tools.py index 9b8aeed5..6a4ff715 100644 --- a/example/expression/simplification_tools.py +++ b/example/expression/simplification_tools.py @@ -21,8 +21,8 @@ e = ExprId('e') m = ExprMem(a) s = a[:8] -i1 = ExprInt(uint32(0x1)) -i2 = ExprInt(uint32(0x2)) +i1 = ExprInt(0x1, 32) +i2 = ExprInt(0x2, 32) cc = ExprCond(a, b, c) o = ExprCompose(a[8:16], a[:8]) @@ -33,12 +33,12 @@ l = [a[:8], b[:8], c[:8], m[:8], s, i1[:8], i2[:8], o[:8]] l2 = l[::-1] -x = ExprMem(a + b + ExprInt32(0x42)) +x = ExprMem(a + b + ExprInt(0x42, 32)) def replace_expr(e): # print 'visit', e - dct = {c + ExprInt32(0x42): d, + dct = {c + ExprInt(0x42, 32): d, a + b: c, } if e in dct: return dct[e] @@ -60,9 +60,9 @@ print z.copy() print z[:31].copy().visit(replace_expr) print 'replace' -print x.replace_expr({c + ExprInt32(0x42): d, +print x.replace_expr({c + ExprInt(0x42, 32): d, a + b: c, }) -print z.replace_expr({c + ExprInt32(0x42): d, +print z.replace_expr({c + ExprInt(0x42, 32): d, a + b: c, }) diff --git a/example/expression/solve_condition_stp.py b/example/expression/solve_condition_stp.py index 03d652cf..0ca17faa 100644 --- a/example/expression/solve_condition_stp.py +++ b/example/expression/solve_condition_stp.py @@ -11,6 +11,7 @@ from miasm2.arch.x86.sem import * from miasm2.core.bin_stream import bin_stream_str from miasm2.core import asmblock from miasm2.expression.expression import get_rw +from miasm2.expression.modint import uint32 from miasm2.ir.symbexec import SymbolicExecutionEngine from miasm2.expression.simplifications import expr_simp from miasm2.expression import stp @@ -134,7 +135,7 @@ if __name__ == '__main__': reg_and_id = dict(mn_x86.regs.all_regs_ids_byname) def my_ast_int2expr(a): - return ExprInt32(a) + return ExprInt(a, 32) # Modifify parser to avoid label creation in PUSH argc def my_ast_id2expr(string_parsed): diff --git a/example/symbol_exec/depgraph.py b/example/symbol_exec/depgraph.py index b4f793c0..0b971b15 100644 --- a/example/symbol_exec/depgraph.py +++ b/example/symbol_exec/depgraph.py @@ -5,7 +5,7 @@ import json from miasm2.analysis.machine import Machine from miasm2.analysis.binary import Container from miasm2.analysis.depgraph import DependencyGraph -from miasm2.expression.expression import ExprMem, ExprId, ExprInt32 +from miasm2.expression.expression import ExprMem, ExprId, ExprInt parser = ArgumentParser("Dependency grapher") parser.add_argument("filename", help="Binary to analyse") @@ -55,7 +55,7 @@ if args.rename_args: if arch == "x86_32": # StdCall example for i in xrange(4): - e_mem = ExprMem(ExprId("ESP_init") + ExprInt32(4 * (i + 1)), 32) + e_mem = ExprMem(ExprId("ESP_init") + ExprInt(4 * (i + 1), 32), 32) init_ctx[e_mem] = ExprId("arg%d" % i) # Disassemble the targeted function |