hooks.py 文件源码

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

项目:idascripts 作者: ctfhacker 项目源码 文件源码
def rename(ea, newname):
    fl = database.type.flags(ea)
    labelQ, customQ = (fl & n == n for n in (idaapi.FF_LABL,idaapi.FF_NAME))
    #r, fn = database.xref.up(ea), idaapi.get_func(ea)
    fn = idaapi.get_func(ea)

    # figure out whether a global or function name is being changed, otherwise it's the function's contents
    ctx = internal.comment.globals if not fn or (fn.startEA == ea) else internal.comment.contents

    # if a name is being removed
    if not newname:
        # if it's a custom name
        if (not labelQ and customQ):
            ctx.dec(ea, '__name__')
        return

    # if it's currently a label or is unnamed
    if (labelQ and not customQ) or all(not n for n in (labelQ,customQ)):
        ctx.inc(ea, '__name__')
    return
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号