about summary refs log tree commit diff stats
path: root/example/disasm
diff options
context:
space:
mode:
Diffstat (limited to 'example/disasm')
-rw-r--r--example/disasm/callback.py4
-rw-r--r--example/disasm/file.py6
-rw-r--r--example/disasm/full.py10
-rw-r--r--example/disasm/function.py10
4 files changed, 12 insertions, 18 deletions
diff --git a/example/disasm/callback.py b/example/disasm/callback.py
index 6c77023e..4a7507dd 100644
--- a/example/disasm/callback.py
+++ b/example/disasm/callback.py
@@ -63,5 +63,5 @@ blocks_after = mdis.dis_multibloc(0)
 print "\n".join(str(block) for block in blocks_after)
 
 # Ensure the callback has been called
-assert blocks[0].lines[0].name == "CALL"
-assert blocks_after[0].lines[0].name == "PUSH"
+assert blocks.heads()[0].lines[0].name == "CALL"
+assert blocks_after.heads()[0].lines[0].name == "PUSH"
diff --git a/example/disasm/file.py b/example/disasm/file.py
index 1b9347d8..db5cd96b 100644
--- a/example/disasm/file.py
+++ b/example/disasm/file.py
@@ -1,6 +1,5 @@
 import sys
 from miasm2.arch.x86.disasm import dis_x86_32
-from miasm2.core.asmbloc import bloc2graph
 from miasm2.analysis.binary import Container
 from pdb import pm
 
@@ -14,7 +13,6 @@ cont = Container.from_stream(open(sys.argv[1]))
 mdis = dis_x86_32(cont.bin_stream)
 # Inform the engine to avoid disassembling null instructions
 mdis.dont_dis_nulstart_bloc = True
-blocs = mdis.dis_multibloc(addr)
+blocks = mdis.dis_multibloc(addr)
 
-graph = bloc2graph(blocs)
-open('graph.dot', 'w').write(graph)
+open('graph.dot', 'w').write(blocks.dot())
diff --git a/example/disasm/full.py b/example/disasm/full.py
index 33b2f41f..25e3a018 100644
--- a/example/disasm/full.py
+++ b/example/disasm/full.py
@@ -4,7 +4,7 @@ from argparse import ArgumentParser
 from pdb import pm
 
 from miasm2.analysis.binary import Container
-from miasm2.core.asmbloc import log_asmbloc, asm_label, bloc2graph
+from miasm2.core.asmbloc import log_asmbloc, asm_label, BasicBlocks
 from miasm2.expression.expression import ExprId
 from miasm2.core.interval import interval
 from miasm2.analysis.machine import Machine
@@ -142,15 +142,13 @@ while not finish and todo:
 
 
 # Generate dotty graph
-all_blocs = []
+all_blocs = BasicBlocks()
 for blocs in all_funcs_blocs.values():
     all_blocs += blocs
-    # for b in blocs:
-    #    print b
+
 
 log.info('generate graph file')
-g = bloc2graph(all_blocs, True)
-open('graph_execflow.dot', 'w').write(g)
+open('graph_execflow.dot', 'w').write(all_blocs.dot(label=True))
 
 log.info('generate intervals')
 
diff --git a/example/disasm/function.py b/example/disasm/function.py
index a1a9b393..1fe1754f 100644
--- a/example/disasm/function.py
+++ b/example/disasm/function.py
@@ -1,5 +1,4 @@
 from miasm2.arch.x86.disasm import dis_x86_32
-from miasm2.core.asmbloc import bloc2graph
 
 # MOV        EAX, 0x1337BEEF
 # MOV        ECX, 0x4
@@ -9,10 +8,9 @@ from miasm2.core.asmbloc import bloc2graph
 # 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)
+blocks = mdis.dis_multibloc(0)
 
-for bloc in blocs:
-    print bloc
+for block in blocks:
+    print block
 
-graph = bloc2graph(blocs)
-open('graph.dot', 'w').write(graph)
+open('graph.dot', 'w').write(blocks.dot())