本文整理匯總了Python中miasm2.core.graph.DiGraph.dot方法的典型用法代碼示例。如果您正苦於以下問題:Python DiGraph.dot方法的具體用法?Python DiGraph.dot怎麽用?Python DiGraph.dot使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類miasm2.core.graph.DiGraph
的用法示例。
在下文中一共展示了DiGraph.dot方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: gen_bloc_data_flow_graph
# 需要導入模塊: from miasm2.core.graph import DiGraph [as 別名]
# 或者: from miasm2.core.graph.DiGraph import dot [as 別名]
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())
示例2: gen_bloc_data_flow_graph
# 需要導入模塊: from miasm2.core.graph import DiGraph [as 別名]
# 或者: from miasm2.core.graph.DiGraph import dot [as 別名]
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())
示例3: gen_block_data_flow_graph
# 需要導入模塊: from miasm2.core.graph import DiGraph [as 別名]
# 或者: from miasm2.core.graph.DiGraph import dot [as 別名]
def gen_block_data_flow_graph(ir_arch, ircfg, ad, block_flow_cb):
for irblock in ircfg.blocks.values():
print irblock
dead_simp(ir_arch, ircfg)
irblock_0 = None
for irblock in ircfg.blocks.values():
loc_key = irblock.loc_key
offset = ircfg.loc_db.get_location_offset(loc_key)
if offset == ad:
irblock_0 = irblock
break
assert(irblock_0 is not None)
flow_graph = DiGraph()
flow_graph.node2str = lambda n: node2str(flow_graph, n)
irb_in_nodes = {}
irb_out_nodes = {}
for label in ircfg.blocks:
irb_in_nodes[label] = {}
irb_out_nodes[label] = {}
for label, irblock in ircfg.blocks.iteritems():
block_flow_cb(ir_arch, ircfg, flow_graph, irblock, irb_in_nodes[label], irb_out_nodes[label])
for label in ircfg.blocks:
print label
print 'IN', [str(x) for x in irb_in_nodes[label]]
print 'OUT', [str(x) for x in irb_out_nodes[label]]
print '*' * 20, 'interblock', '*' * 20
inter_block_flow(ir_arch, ircfg, flow_graph, irblock_0.loc_key, irb_in_nodes, irb_out_nodes)
# from graph_qt import graph_qt
# graph_qt(flow_graph)
open('data.dot', 'w').write(flow_graph.dot())