about summary refs log tree commit diff stats
path: root/example/expression/expr_grapher.py
diff options
context:
space:
mode:
authorCamille Mougey <camille.mougey@cea.fr>2014-09-19 13:58:03 +0200
committerCamille Mougey <camille.mougey@cea.fr>2014-09-19 13:58:03 +0200
commit2bc1d7810dd07f9a0401984125fc82ac5ac7d9aa (patch)
tree40e084cd2bb9e6224c1fdbfef158f71102863897 /example/expression/expr_grapher.py
parent69c35ab316c0dae069ad7fb9d0567c6dd8746a8e (diff)
downloadfocaccia-miasm-2bc1d7810dd07f9a0401984125fc82ac5ac7d9aa.tar.gz
focaccia-miasm-2bc1d7810dd07f9a0401984125fc82ac5ac7d9aa.zip
Expression examples: Rename examples with meaningfull names
Diffstat (limited to 'example/expression/expr_grapher.py')
-rw-r--r--example/expression/expr_grapher.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/example/expression/expr_grapher.py b/example/expression/expr_grapher.py
new file mode 100644
index 00000000..d1cbb73b
--- /dev/null
+++ b/example/expression/expr_grapher.py
@@ -0,0 +1,21 @@
+from miasm2.core.graph import DiGraph
+from miasm2.expression.expression import *
+
+print "Simple Expression grapher demo"
+
+a = ExprId("A")
+b = ExprId("B")
+c = ExprId("C")
+d = ExprId("D")
+m = ExprMem(a + b + c + a)
+
+e1 = ExprCompose([(a + b - (c * a) / m | b, 0, 32), (a + m, 32, 64)])
+e2 = ExprInt64(15)
+e = ExprCond(d, e1, e2)[0:32]
+
+print "[+] Expression:"
+print e
+
+g = e.graph()
+print "[+] Graph:"
+print g.dot()