blob: afeb408183966e74f11dcb5e4dae4f06f20ac4c6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
from __future__ import print_function
from miasm.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)
# + automatically 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)]
|