miasm
Reverse engineering framework
|
Functions | |
def | check (expr_in, expr_out) |
Variables | |
parser = ArgumentParser("Expression simplification regression tests") | |
action | |
help | |
args = parser.parse_args() | |
trans = Translator.to_language("z3") | |
check = lambda expr_in, expr_out: None | |
a = ExprId('a', 32) | |
b = ExprId('b', 32) | |
c = ExprId('c', 32) | |
d = ExprId('d', 32) | |
e = ExprId('e', 32) | |
f = ExprId('f', size=64) | |
b_msb_null = b[:31].zeroExtend(32) | |
c_msb_null = c[:31].zeroExtend(32) | |
a31 = ExprId('a31', 31) | |
b31 = ExprId('b31', 31) | |
c31 = ExprId('c31', 31) | |
b31_msb_null = ExprId('b31', 31)[:30].zeroExtend(31) | |
c31_msb_null = ExprId('c31', 31)[:30].zeroExtend(31) | |
a8 = ExprId('a8', 8) | |
b8 = ExprId('b8', 8) | |
c8 = ExprId('c8', 8) | |
d8 = ExprId('d8', 8) | |
e8 = ExprId('e8', 8) | |
m = ExprMem(a, 32) | |
s = a[:8] | |
i0 = ExprInt(0, 32) | |
i1 = ExprInt(1, 32) | |
i2 = ExprInt(2, 32) | |
i3 = ExprInt(3, 32) | |
im1 = ExprInt(-1, 32) | |
im2 = ExprInt(-2, 32) | |
bi0 = ExprInt(0, 1) | |
bi1 = ExprInt(1, 1) | |
icustom = ExprInt(0x12345678, 32) | |
cc = ExprCond(a, b, c) | |
o = ExprCompose(a[8:16], a[:8]) | |
o2 = ExprCompose(a[8:16], a[:8]) | |
list | l = [a[:8], b[:8], c[:8], m[:8], s, i1[:8], i2[:8], o[:8]] |
list | l2 = l[::-1] |
x = ExprMem(a + b + ExprInt(0x42, 32), 32) | |
list | to_test |
e_new = expr_simp_explicit(e_input) | |
rez = e_check | |
e_check = expr_simp(e_check) | |
x1 = ExprId("x1", 32) | |
x2 = ExprId("x2", 32) | |
i1_tmp = ExprInt(1, 1) | |
x1_z3 = trans.from_expr(x1) | |
x2_z3 = trans.from_expr(x2) | |
i1_z3 = trans.from_expr(i1_tmp) | |
list | tests |
solver = z3.Solver() | |
y = ExprId('y', 32) | |
z = ExprId('z', 32) | |
jra = ExprId('jra', 32) | |
jrb = ExprId('jrb', 32) | |
jrint1 = ExprId('jrint1', 32) | |
e1 = ExprMem((a & ExprInt(0xFFFFFFFC, 32)) + ExprInt(0x10, 32), 32) | |
e2 = ExprMem((a & ExprInt(0xFFFFFFFC, 32)) + b, 32) | |
tuple | e3 = (a ^ b ^ ((a ^ b) & (b ^ (b - a))) ^ (b - a)).canonize() |
list | match_tests |
list | get_tests |
def simplifications.check | ( | expr_in, | |
expr_out | |||
) |
Check that expr_in is always equals to expr_out
simplifications.a = ExprId('a', 32) |
simplifications.a31 = ExprId('a31', 31) |
simplifications.a8 = ExprId('a8', 8) |
simplifications.action |
simplifications.args = parser.parse_args() |
simplifications.b = ExprId('b', 32) |
simplifications.b31 = ExprId('b31', 31) |
simplifications.b8 = ExprId('b8', 8) |
simplifications.b_msb_null = b[:31].zeroExtend(32) |
simplifications.bi0 = ExprInt(0, 1) |
simplifications.bi1 = ExprInt(1, 1) |
simplifications.c = ExprId('c', 32) |
simplifications.c31 = ExprId('c31', 31) |
simplifications.c8 = ExprId('c8', 8) |
simplifications.c_msb_null = c[:31].zeroExtend(32) |
simplifications.check = lambda expr_in, expr_out: None |
simplifications.d = ExprId('d', 32) |
simplifications.d8 = ExprId('d8', 8) |
simplifications.e = ExprId('e', 32) |
simplifications.e8 = ExprId('e8', 8) |
simplifications.e_check = expr_simp(e_check) |
simplifications.e_new = expr_simp_explicit(e_input) |
simplifications.f = ExprId('f', size=64) |
list simplifications.get_tests |
simplifications.help |
simplifications.i0 = ExprInt(0, 32) |
simplifications.i1 = ExprInt(1, 32) |
simplifications.i1_tmp = ExprInt(1, 1) |
simplifications.i1_z3 = trans.from_expr(i1_tmp) |
simplifications.i2 = ExprInt(2, 32) |
simplifications.i3 = ExprInt(3, 32) |
simplifications.icustom = ExprInt(0x12345678, 32) |
simplifications.im1 = ExprInt(-1, 32) |
simplifications.im2 = ExprInt(-2, 32) |
simplifications.jra = ExprId('jra', 32) |
simplifications.jrb = ExprId('jrb', 32) |
simplifications.jrint1 = ExprId('jrint1', 32) |
list simplifications.l2 = l[::-1] |
list simplifications.match_tests |
simplifications.o = ExprCompose(a[8:16], a[:8]) |
simplifications.o2 = ExprCompose(a[8:16], a[:8]) |
simplifications.parser = ArgumentParser("Expression simplification regression tests") |
simplifications.rez = e_check |
simplifications.s = a[:8] |
simplifications.solver = z3.Solver() |
list simplifications.tests |
list simplifications.to_test |
simplifications.trans = Translator.to_language("z3") |
simplifications.x1 = ExprId("x1", 32) |
simplifications.x1_z3 = trans.from_expr(x1) |
simplifications.x2 = ExprId("x2", 32) |
simplifications.x2_z3 = trans.from_expr(x2) |
simplifications.y = ExprId('y', 32) |
simplifications.z = ExprId('z', 32) |