database.py 文件源码

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

项目:idascripts 作者: ctfhacker 项目源码 文件源码
def tag_write(ea, key, none):
    '''Removes the tag specified by ``key`` from the address ``ea``.'''
    ea = interface.address.inside(ea)

    # if the '__name__' is being cleared, then really remove it.
    if key == '__name__':
        return set_name(ea, None, listed=True)
    if key == '__extra_prefix__':
        return extra.del_prefix(ea)
    if key == '__extra_suffix__':
        return extra.del_suffix(ea)

    # if not within a function, then fetch the repeatable comment
    # otherwise update the non-repeatable one
    try: func = function.by_address(ea)
    except: func = None
    repeatable = False if func else True

    # fetch the dict, remove the key, then write it back.
    state = internal.comment.decode(comment(ea, repeatable=not repeatable))
    state and comment(ea, '', repeatable=not repeatable) # clear the old one
    state.update(internal.comment.decode(comment(ea, repeatable=repeatable)))
    res = state.pop(key)
    comment(ea, internal.comment.encode(state), repeatable=repeatable)

    # delete it's reference
    if func:
        internal.comment.contents.dec(ea, key)
    else:
        internal.comment.globals.dec(ea, key)

    return res

#FIXME: define tag_erase
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号