label_functions.py 文件源码

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

项目:shannonRE 作者: Comsecuris 项目源码 文件源码
def apply_labels(fun_names):
    new_sub = 0
    new_som = 0
    new_oth = 0

    named_overwrittens = []

    for f_ea, name in fun_names.iteritems():
        name = re.sub('[^a-zA-Z0-9_]+', '', name)
        curr_name = idaapi.get_func_name(f_ea)
        if curr_name.startswith("sub_"):
            new_sub += 1
        elif "_something" in curr_name:
            new_som += 1
        else:
            new_oth += 1
            named_overwrittens.append(curr_name)
            #so we don't overwrite these
            continue

        # stats counting aside, make sure we don't overwrite non-sub
        # functions from e.g. our IDC assignments
        if not curr_name.startswith("sub_") and not "_something" in curr_name:
            continue

        ret = idc.LocByName(name)
        count = 1
        while (ret != 0xffffffff):
            count += 1
            ret = idc.LocByName(name + "__" + "%d" % count)
        idc.MakeName(f_ea, name + ("__%d" % count)*(count > 1))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号