__init__.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:binaryninja-varslice 作者: endeav0r 项目源码 文件源码
def graph_function_llil_instructions (function) :
    '''
    Returns a graph where each LLIL instruction is a vertex in the graph
    '''
    graph = Graph(0)

    # Get the low_level_il basic blocks
    basic_blocks = function.low_level_il.basic_blocks

    # Add all the low_level_il instructions as their own vertices
    for basic_block in basic_blocks :
        for ins in basic_block :
            graph.add_vertex(ins.instr_index, ins)

    # Go back through and add edges
    for basic_block in basic_blocks :
        # Add edges between instructions in block
        previous_ins = None
        for ins in basic_block :
            if previous_ins == None :
                previous_ins = ins.instr_index
                continue
            graph.add_edge_by_indices(previous_ins, ins.instr_index)
            previous_ins = ins.instr_index
        # Add edges between basic blocks
        for outgoing_edge in basic_block.outgoing_edges :
            target = outgoing_edge.target.start
            graph.add_edge_by_indices(previous_ins, target)

    return graph
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号