Ejemplo n.º 1
0
def get_func_cfgs_c(ea):
    binary_name = idc.GetInputFile()
    raw_cfgs = raw_graphs(binary_name)
    externs_eas, ea_externs = processpltSegs()
    i = 0

    for funcea in Functions(SegStart(ea)):
        print(funcea)
        funcname = get_unified_funcname(funcea)
        func = get_func(funcea)
        print i
        #print func
        i += 1
        icfg = cfg.getCfg(func, externs_eas, ea_externs)
        #attribute

        # print icfg[0].node[0]['numIns']
        # print icfg[0].node[0]['numCalls']
        #print icfg[0].node[0]['numLIs']
        #pickle.dump(icfg, open("F:\work now\data\\"+"icfg.txt",'w'))
        func_f = get_discoverRe_feature(func, icfg[0])

        # this graph is a func's cfg,the node is basic_block
        raw_g = raw_graph(funcname, icfg, func_f)
        #pickle.dump(raw_g, open("F:\work now\data\\"+"raw_g.txt",'w'))
        raw_cfgs.append(raw_g)
        #print raw_cfgs.raw_graph_list[0].funcname
        #print raw_cfgs.raw_graph_list[0].old_g

    # the raw_cfgs is the class(list) of func's cfg
    return raw_cfgs
Ejemplo n.º 2
0
def get_func_cfgs(ea):
    func_cfglist = {}
    i = 0
    for funcea in Functions(SegStart(ea)):
        funcname = get_unified_funcname(funcea)
        func = get_func(funcea)
        print i
        i += 1
        try:
            icfg = cfg.getCfg(func)
            func_cfglist[funcname] = icfg
        except:
            pass

    return func_cfglist
Ejemplo n.º 3
0
def get_func_cfgs_c(ea):
    binary_name = idc.get_root_filename()
    raw_cfgs = raw_graphs(binary_name)
    externs_eas, ea_externs = processpltSegs()
    i = 0
    for funcea in idautils.Functions(idc.get_segm_start(ea)):
        funcname = get_unified_funcname(funcea)
        func = ida_funcs.get_func(funcea)
        print i
        i += 1
        icfg = cfg.getCfg(func, externs_eas, ea_externs)
        func_f = get_discoverRe_feature(func, icfg[0])
        raw_g = raw_graph(funcname, icfg, func_f)
        raw_cfgs.append(raw_g)

    return raw_cfgs
Ejemplo n.º 4
0
def get_func_cfgs_c(ea):
	binary_name = idc.GetInputFile()
	raw_cfgs = raw_graphs(binary_name)
	externs_eas, ea_externs = processpltSegs()
	i = 0
	for funcea in Functions(SegStart(ea)):
		funcname = get_unified_funcname(funcea)
		func = get_func(funcea)
		print i
		i += 1
		icfg = cfg.getCfg(func, externs_eas, ea_externs)
		func_f = get_discoverRe_feature(func, icfg[0])
		raw_g = raw_graph(funcname, icfg, func_f)
		raw_cfgs.append(raw_g)
			
	return raw_cfgs
Ejemplo n.º 5
0
def get_func_cfgs_ctest(ea):
    binary_name = idc.GetInputFile()
    raw_cfgs = raw_graphs(binary_name)
    externs_eas, ea_externs = processpltSegs()
    i = 0
    diffs = {}
    for funcea in Functions(SegStart(ea)):
        funcname = get_unified_funcname(funcea)
        func = get_func(funcea)
        print i
        i += 1
        icfg, old_cfg = cfg.getCfg(func, externs_eas, ea_externs)
        diffs[funcname] = (icfg, old_cfg)
        #raw_g = raw_graph(funcname, icfg)
        #raw_cfgs.append(raw_g)

    return diffs
Ejemplo n.º 6
0
def get_func_cfgs_c(ea):
    '''
	ea:binary的起始地址
	return: 每个函数的原生属性控制流图(未向量化)的列表
	'''
    binary_name = GetInputFile()
    raw_cfgs = raw_graphs(binary_name)
    externs_eas, ea_externs = processpltSegs()
    i = 0
    segm = get_segm_by_name(".text")
    for funcea in Functions(segm.start_ea, segm.end_ea):
        funcname = get_unified_funcname(funcea)
        func = get_func(funcea)  # 得到func这个类对象
        #print i
        i += 1
        icfg = cfg.getCfg(func, externs_eas, ea_externs)  # 为每个函数构建Genius 的ACFG
        func_f = get_discoverRe_feature(func, icfg)  # 生成DiscoverRe中的函数特征
        raw_g = raw_graph(funcname, icfg, func_f)
        raw_cfgs.append(raw_g)

    return raw_cfgs