about summary refs log tree commit diff stats
path: root/example/disasm/function.py
diff options
context:
space:
mode:
authorserpilliere <serpilliere@users.noreply.github.com>2015-01-26 10:04:24 +0100
committerserpilliere <serpilliere@users.noreply.github.com>2015-01-26 10:04:24 +0100
commitb87f775c1a6a5c78c62beee925eaba6dc337577e (patch)
treecf2650f575971bf8a23655a28c944e9e8a9da561 /example/disasm/function.py
parentc59591a779ac644d1b50a720aea93cd8b36a2ddf (diff)
parent7b9bbe4754db4d1f5229cc5cc5769ad6cf2e0a84 (diff)
downloadmiasm-b87f775c1a6a5c78c62beee925eaba6dc337577e.tar.gz
miasm-b87f775c1a6a5c78c62beee925eaba6dc337577e.zip
Merge pull request #45 from commial/refactor-examples
Refactor examples
Diffstat (limited to 'example/disasm/function.py')
-rw-r--r--example/disasm/function.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/example/disasm/function.py b/example/disasm/function.py
new file mode 100644
index 00000000..0d443c26
--- /dev/null
+++ b/example/disasm/function.py
@@ -0,0 +1,18 @@
+from miasm2.arch.x86.disasm import dis_x86_32
+from miasm2.core.asmbloc import bloc2graph
+
+# MOV        EAX, 0x1337BEEF
+# MOV        ECX, 0x4
+# loop:
+# ROL        EAX, 0x8
+# LOOP       loop
+# RET
+shellcode = '\xb8\xef\xbe7\x13\xb9\x04\x00\x00\x00\xc1\xc0\x08\xe2\xfb\xc3'
+mdis = dis_x86_32(shellcode)
+blocs = mdis.dis_multibloc(0)
+
+for bloc in blocs:
+    print bloc
+
+graph = bloc2graph(blocs)
+open('graph.txt', 'w').write(graph)