hooks.py 文件源码

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

项目:idascripts 作者: ctfhacker 项目源码 文件源码
def extra_cmt_changed(ea, line_idx, cmt):
    # FIXME: persist state for extra_cmts in order to determine
    #        what the original value was before modification

    oldcmt = internal.netnode.sup.get(ea, line_idx)
    ctx = internal.comment.contents if idaapi.get_func(ea) else internal.comment.globals

    MAX_ITEM_LINES = (idaapi.E_NEXT-idaapi.E_PREV) if idaapi.E_NEXT > idaapi.E_PREV else idaapi.E_PREV-idaapi.E_NEXT
    prefix = (idaapi.E_PREV, idaapi.E_PREV+MAX_ITEM_LINES, '__extra_prefix__')
    suffix = (idaapi.E_NEXT, idaapi.E_NEXT+MAX_ITEM_LINES, '__extra_suffix__')

    for l,r,key in (prefix,suffix):
        if l <= line_idx < r:
            if oldcmt is None and cmt: ctx.inc(ea, key)
            elif oldcmt and cmt is None: ctx.dec(ea, key)
        continue
    return

### function scope
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号