def gen_bloc_data_flow_graph(ir_arch, ad, block_flow_cb): for irbloc in ir_arch.blocs.values(): print irbloc ir_arch.gen_graph() ir_arch.dead_simp() irbloc_0 = None for irbloc in ir_arch.blocs.values(): if irbloc.label.offset == ad: irbloc_0 = irbloc break assert(irbloc_0 is not None) flow_graph = DiGraph() flow_graph.node2str = lambda n: node2str(flow_graph, n) for irbloc in ir_arch.blocs.values(): block_flow_cb(ir_arch, flow_graph, irbloc) for irbloc in ir_arch.blocs.values(): print irbloc print 'IN', [str(x) for x in irbloc.in_nodes] print 'OUT', [str(x) for x in irbloc.out_nodes] print '*' * 20, 'interbloc', '*' * 20 inter_bloc_flow(ir_arch, flow_graph, irbloc_0.label) # from graph_qt import graph_qt # graph_qt(flow_graph) open('data.dot', 'w').write(flow_graph.dot())
def gen_block_data_flow_graph(ir_arch, ad, block_flow_cb): for irblock in ir_arch.blocks.values(): print irblock ir_arch.dead_simp() irblock_0 = None for irblock in ir_arch.blocks.values(): if irblock.label.offset == ad: irblock_0 = irblock break assert (irblock_0 is not None) flow_graph = DiGraph() flow_graph.node2str = lambda n: node2str(flow_graph, n) for irblock in ir_arch.blocks.values(): block_flow_cb(ir_arch, flow_graph, irblock) for irblock in ir_arch.blocks.values(): print irblock print 'IN', [str(x) for x in irblock.in_nodes] print 'OUT', [str(x) for x in irblock.out_nodes] print '*' * 20, 'interblock', '*' * 20 inter_bloc_flow(ir_arch, flow_graph, irblock_0.label) # from graph_qt import graph_qt # graph_qt(flow_graph) open('data.dot', 'w').write(flow_graph.dot())
def gen_bloc_data_flow_graph( ir_arch, in_str, ad): # arch, attrib, pool_bin, bloc, symbol_pool): out_str = "" # ir_arch = ir_x86_32(symbol_pool) for irbloc in ir_arch.blocs.values(): print irbloc ir_arch.gen_graph() ir_arch.dead_simp() irbloc_0 = None for irbloc in ir_arch.blocs.values(): if irbloc.label.offset == ad: irbloc_0 = irbloc break assert (irbloc_0 is not None) flow_graph = DiGraph() flow_graph.node2str = lambda n: node2str(flow_graph, n) done = set() todo = set([irbloc_0.label]) bloc2w = {} for irbloc in ir_arch.blocs.values(): intra_bloc_flow_raw(ir_arch, flow_graph, irbloc) # intra_bloc_flow_symb(ir_arch, flow_graph, irbloc) for irbloc in ir_arch.blocs.values(): print irbloc print 'IN', [str(x) for x in irbloc.in_nodes] print 'OUT', [str(x) for x in irbloc.out_nodes] print '*' * 20, 'interbloc', '*' * 20 inter_bloc_flow(ir_arch, flow_graph, irbloc_0.label) # sys.path.append('/home/serpilliere/projet/m2_devel/miasm2/core') # from graph_qt import graph_qt # graph_qt(flow_graph) open('data.txt', 'w').write(flow_graph.dot())
def gen_bloc_data_flow_graph(ir_arch, in_str, ad): # arch, attrib, pool_bin, bloc, symbol_pool): out_str = "" # ir_arch = ir_x86_32(symbol_pool) for irbloc in ir_arch.blocs.values(): print irbloc ir_arch.gen_graph() ir_arch.dead_simp() irbloc_0 = None for irbloc in ir_arch.blocs.values(): if irbloc.label.offset == ad: irbloc_0 = irbloc break assert(irbloc_0 is not None) flow_graph = DiGraph() flow_graph.node2str = lambda n: node2str(flow_graph, n) done = set() todo = set([irbloc_0.label]) bloc2w = {} for irbloc in ir_arch.blocs.values(): intra_bloc_flow_raw(ir_arch, flow_graph, irbloc) # intra_bloc_flow_symb(ir_arch, flow_graph, irbloc) for irbloc in ir_arch.blocs.values(): print irbloc print 'IN', [str(x) for x in irbloc.in_nodes] print 'OUT', [str(x) for x in irbloc.out_nodes] print '*' * 20, 'interbloc', '*' * 20 inter_bloc_flow(ir_arch, flow_graph, irbloc_0.label) # sys.path.append('/home/serpilliere/projet/m2_devel/miasm2/core') # from graph_qt import graph_qt # graph_qt(flow_graph) open('data.txt', 'w').write(flow_graph.dot())
def gen_bloc_data_flow_graph( ir_arch, in_str, ad): # arch, attrib, pool_bin, bloc, symbol_pool): out_str = "" ir_arch.gen_graph() # ir_arch.dead_simp() irbloc_0 = None for irbloc in ir_arch.blocs.values(): if irbloc.label.offset == ad: irbloc_0 = irbloc break assert (irbloc_0 is not None) flow_graph = DiGraph() done = set() todo = set([irbloc_0.label]) bloc2w = {} for irbloc in ir_arch.blocs.values(): # intra_bloc_flow_raw(ir_arch, flow_graph, irbloc) intra_bloc_flow_symbexec(ir_arch, flow_graph, irbloc) # intra_bloc_flow_symb(ir_arch, flow_graph, irbloc) for irbloc in ir_arch.blocs.values(): print irbloc print 'IN', [str(x) for x in irbloc.in_nodes] print 'OUT', [str(x) for x in irbloc.out_nodes] print '*' * 20, 'interbloc', '*' * 20 inter_bloc_flow(ir_arch, flow_graph, irbloc_0.label, False) print 'Dataflow roots:' for node in flow_graph.roots(): lbl, i, n = node if n in ir_arch.arch.regs.all_regs_ids: print node open('data.txt', 'w').write(flow_graph.dot()) return flow_graph
def gen_bloc_data_flow_graph(ir_arch, in_str, ad): # arch, attrib, pool_bin, bloc, symbol_pool): out_str = "" ir_arch.gen_graph() # ir_arch.dead_simp() irbloc_0 = None for irbloc in ir_arch.blocs.values(): if irbloc.label.offset == ad: irbloc_0 = irbloc break assert(irbloc_0 is not None) flow_graph = DiGraph() done = set() todo = set([irbloc_0.label]) bloc2w = {} for irbloc in ir_arch.blocs.values(): # intra_bloc_flow_raw(ir_arch, flow_graph, irbloc) intra_bloc_flow_symbexec(ir_arch, flow_graph, irbloc) # intra_bloc_flow_symb(ir_arch, flow_graph, irbloc) for irbloc in ir_arch.blocs.values(): print irbloc print 'IN', [str(x) for x in irbloc.in_nodes] print 'OUT', [str(x) for x in irbloc.out_nodes] print '*' * 20, 'interbloc', '*' * 20 inter_bloc_flow(ir_arch, flow_graph, irbloc_0.label, False) print 'Dataflow roots:' for node in flow_graph.roots(): lbl, i, n = node if n in ir_arch.arch.regs.all_regs_ids: print node open('data.txt', 'w').write(flow_graph.dot()) return flow_graph