mirror of
https://github.com/cea-sec/miasm
synced 2026-06-21 13:48:18 +00:00
5dec442348
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
26 lines
483 B
Python
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)
|