Files
cea-sec-miasm/example/expression/manip_expression3.py
T
serpilliere 5dec442348 remove useless ExprSliceTo
exprsliceto is only used in exprcompose, so it can be removed from
IL representation, and exprcompose will deal start/stop fields
WARNING: as IL is modified, it may break a lot of scripts
2012-05-08 18:33:55 +02:00

26 lines
483 B
Python

from miasm.arch.ia32_sem import *
from miasm.expression.expression_helper import *
print 'simple expression simplification demo'
print
a = ExprId('eax')
b = ExprId('ebx')
c = a + b
d = c - a
print d
# ((eax + ebx) - eax)
print "=>", expr_simp(d)
print
# ebx
e = ExprInt(uint32(0x12)) + ExprInt(uint32(0x30)) - a
print e
# ((0x12 + 0x30) - eax)
print "=>", expr_simp(e)
# (0x42 - eax)
o = ExprCompose([(a[:8], 0, 8),
(a[8:16], 8, 16)])
print o
print expr_simp(o)