mirror of
https://github.com/cea-sec/miasm
synced 2026-06-21 13:48:18 +00:00
32 lines
431 B
Python
32 lines
431 B
Python
from miasm2.expression.expression import *
|
|
|
|
print """
|
|
Simple expression manipulation demo
|
|
"""
|
|
|
|
# define 2 ID
|
|
a = ExprId('eax', 32)
|
|
b = ExprId('ebx', 32)
|
|
print a, b
|
|
# eax ebx
|
|
|
|
# add those ID
|
|
c = ExprOp('+', a, b)
|
|
print c
|
|
# (eax + ebx)
|
|
|
|
# + automaticaly generates ExprOp('+', a, b)
|
|
c = a + b
|
|
print c
|
|
# (eax + ebx)
|
|
|
|
# ax is a slice of eax
|
|
ax = a[:16]
|
|
print ax
|
|
# eax[0:16]
|
|
|
|
# memory deref
|
|
d = ExprMem(c, 32)
|
|
print d
|
|
# @32[(eax + ebx)]
|