diff options
| author | Ajax <commial@gmail.com> | 2015-11-09 14:49:51 +0100 |
|---|---|---|
| committer | Ajax <commial@gmail.com> | 2015-11-09 15:01:12 +0100 |
| commit | b4114c3e786cf9c90b9c81cb4594d7775a266f5d (patch) | |
| tree | 55e86387c9e1ee9b2b0c7fed92d8cf6cffde9160 /example | |
| parent | 7681a432c7c98df9d075701a172df0d5f311f753 (diff) | |
| download | miasm-b4114c3e786cf9c90b9c81cb4594d7775a266f5d.tar.gz miasm-b4114c3e786cf9c90b9c81cb4594d7775a266f5d.zip | |
Example: move output .txt to .dot
Diffstat (limited to 'example')
| -rw-r--r-- | example/asm/shellcode.py | 2 | ||||
| -rw-r--r-- | example/disasm/file.py | 2 | ||||
| -rw-r--r-- | example/disasm/full.py | 6 | ||||
| -rw-r--r-- | example/disasm/function.py | 2 | ||||
| -rw-r--r-- | example/expression/asm_to_ir.py | 4 | ||||
| -rw-r--r-- | example/expression/get_read_write.py | 2 | ||||
| -rw-r--r-- | example/expression/graph_dataflow.py | 6 | ||||
| -rw-r--r-- | example/expression/solve_condition_stp.py | 4 | ||||
| -rw-r--r-- | example/ida/graph_ir.py | 8 | ||||
| -rw-r--r-- | example/jitter/unpack_upx.py | 4 |
10 files changed, 20 insertions, 20 deletions
diff --git a/example/asm/shellcode.py b/example/asm/shellcode.py index 52630e4d..253386b5 100644 --- a/example/asm/shellcode.py +++ b/example/asm/shellcode.py @@ -77,7 +77,7 @@ if args.PE: for bloc in blocs: print bloc graph = asmbloc.bloc2graph(blocs) -open("graph.txt", "w").write(graph) +open("graph.dot", "w").write(graph) # Apply patches patches = asmbloc.asm_resolve_final(machine.mn, diff --git a/example/disasm/file.py b/example/disasm/file.py index 1a22dfe7..1b9347d8 100644 --- a/example/disasm/file.py +++ b/example/disasm/file.py @@ -17,4 +17,4 @@ mdis.dont_dis_nulstart_bloc = True blocs = mdis.dis_multibloc(addr) graph = bloc2graph(blocs) -open('graph.txt', 'w').write(graph) +open('graph.dot', 'w').write(graph) diff --git a/example/disasm/full.py b/example/disasm/full.py index db12c45b..03928e73 100644 --- a/example/disasm/full.py +++ b/example/disasm/full.py @@ -150,7 +150,7 @@ for blocs in all_funcs_blocs.values(): log.info('generate graph file') g = bloc2graph(all_blocs, True) -open('graph_execflow.txt', 'w').write(g) +open('graph_execflow.dot', 'w').write(g) log.info('generate intervals') @@ -167,7 +167,7 @@ for i, j in done_interval.intervals: all_lines.sort(key=lambda x: x.offset) -open('lines.txt', 'w').write('\n'.join([str(l) for l in all_lines])) +open('lines.dot', 'w').write('\n'.join([str(l) for l in all_lines])) log.info('total lines %s' % total_l) @@ -200,4 +200,4 @@ if args.gen_ir: ir_arch_a.dead_simp() out = ir_arch_a.graph() - open('graph_irflow.txt', 'w').write(out) + open('graph_irflow.dot', 'w').write(out) diff --git a/example/disasm/function.py b/example/disasm/function.py index 0d443c26..a1a9b393 100644 --- a/example/disasm/function.py +++ b/example/disasm/function.py @@ -15,4 +15,4 @@ for bloc in blocs: print bloc graph = bloc2graph(blocs) -open('graph.txt', 'w').write(graph) +open('graph.dot', 'w').write(graph) diff --git a/example/expression/asm_to_ir.py b/example/expression/asm_to_ir.py index ee8a481a..3ed59ffe 100644 --- a/example/expression/asm_to_ir.py +++ b/example/expression/asm_to_ir.py @@ -47,11 +47,11 @@ for lbl, b in ir_arch.blocs.items(): # Dead propagation ir_arch.gen_graph() out = ir_arch.graph() -open('graph.txt', 'w').write(out) +open('graph.dot', 'w').write(out) print '*' * 80 ir_arch.dead_simp() out2 = ir_arch.graph() -open('graph2.txt', 'w').write(out2) +open('graph2.dot', 'w').write(out2) # Display new IR print 'new ir blocs' diff --git a/example/expression/get_read_write.py b/example/expression/get_read_write.py index faa3f9df..f0f48015 100644 --- a/example/expression/get_read_write.py +++ b/example/expression/get_read_write.py @@ -23,4 +23,4 @@ for lbl, b in ir_arch.blocs.items(): print ir_arch.gen_graph() g = ir_arch.graph() -open('graph_instr.txt', 'w').write(g) +open('graph_instr.dot', 'w').write(g) diff --git a/example/expression/graph_dataflow.py b/example/expression/graph_dataflow.py index 1450b33b..e263a40e 100644 --- a/example/expression/graph_dataflow.py +++ b/example/expression/graph_dataflow.py @@ -139,7 +139,7 @@ def gen_bloc_data_flow_graph(ir_arch, ad, block_flow_cb): # from graph_qt import graph_qt # graph_qt(flow_graph) - open('data.txt', 'w').write(flow_graph.dot()) + open('data.dot', 'w').write(flow_graph.dot()) data = open(args.filename).read() @@ -175,8 +175,8 @@ gen_bloc_data_flow_graph(ir_arch, ad, block_flow_cb) print '*' * 40 print """ View with: -dotty dataflow.txt +dotty dataflow.dot or Generate ps with pdf: -dot -Tps dataflow_xx.txt -o graph.ps +dot -Tps dataflow_xx.dot -o graph.ps """ diff --git a/example/expression/solve_condition_stp.py b/example/expression/solve_condition_stp.py index 8c65c83c..034a115f 100644 --- a/example/expression/solve_condition_stp.py +++ b/example/expression/solve_condition_stp.py @@ -228,11 +228,11 @@ if __name__ == '__main__': rez = " AND ".join(all_csts) out.append("QUERY(NOT (%s));" % rez) end = "\n".join(out) - open('out.txt', 'w').write(end) + open('out.dot', 'w').write(end) try: cases = subprocess.check_output(["/home/serpilliere/tools/stp/stp", "-p", - "out.txt"]) + "out.dot"]) except OSError: print "ERF, cannot find stp" break diff --git a/example/ida/graph_ir.py b/example/ida/graph_ir.py index bbb44bbb..c3d88c36 100644 --- a/example/ida/graph_ir.py +++ b/example/ida/graph_ir.py @@ -120,7 +120,7 @@ ab = mdis.dis_multibloc(ad) print "generating graph" g = bloc2graph(ab, True) -open('asm_flow.txt', 'w').write(g) +open('asm_flow.dot', 'w').write(g) print "generating IR... %x" % ad @@ -140,7 +140,7 @@ for irb in ir_arch.blocs.values(): ir_arch.gen_graph() out = ir_arch.graph() -open(os.path.join(tempfile.gettempdir(), 'graph.txt'), 'wb').write(out) +open(os.path.join(tempfile.gettempdir(), 'graph.dot'), 'wb').write(out) # ir_arch.dead_simp() @@ -230,7 +230,7 @@ def gen_bloc_data_flow_graph(ir_arch, in_str, ad): # arch, attrib, pool_bin, bl if n in ir_arch.arch.regs.all_regs_ids: print node - open('data.txt', 'w').write(flow_graph.dot()) + open('data.dot', 'w').write(flow_graph.dot()) return flow_graph @@ -286,7 +286,7 @@ class GraphMiasmIRFlow(GraphViewer): #def node2str(self, n): # return "%s, %s\\l%s" % n #flow_graph.node2str = lambda n: node2str(flow_graph, n) -#open('data_flow.txt', 'w').write(flow_graph.dot()) +#open('data_flow.dot', 'w').write(flow_graph.dot()) # h = GraphMiasmIRFlow(flow_graph, "Miasm IRFlow graph", None) # h.Show() diff --git a/example/jitter/unpack_upx.py b/example/jitter/unpack_upx.py index eb03209b..f1f179b8 100644 --- a/example/jitter/unpack_upx.py +++ b/example/jitter/unpack_upx.py @@ -40,7 +40,7 @@ parser.add_argument("filename", help="PE Filename") parser.add_argument('-v', "--verbose", help="verbose mode", action="store_true") parser.add_argument("--graph", - help="Export the CFG graph in graph.txt", + help="Export the CFG graph in graph.dot", action="store_true") options = parser.parse_args() sb = Sandbox_Win_x86_32(options.filename, options, globals()) @@ -72,7 +72,7 @@ logging.info(end_label) # Export CFG graph (dot format) if options.graph is True: g = asmbloc.bloc2graph(ab) - open("graph.txt", "w").write(g) + open("graph.dot", "w").write(g) if options.verbose is True: |