enum.py 文件源码

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

项目:idascripts 作者: ctfhacker 项目源码 文件源码
def list(**type):
    """List all the enumerations within the database.

    Search type can be identified by providing a named argument.
    like = glob match
    regex = regular expression
    index = particular index
    identifier = particular id number
    pred = function predicate
    """
    res = __builtin__.list(iterate(**type))

    maxindex = max(__builtin__.map(idaapi.get_enum_idx, res))
    maxname = max(__builtin__.map(utils.compose(idaapi.get_enum_name, len), res))
    maxsize = max(__builtin__.map(size, res))
    cindex = math.ceil(math.log(maxindex or 1)/math.log(10))
    cmask = max(__builtin__.map(utils.compose(mask, math.log, functools.partial(operator.mul, 1.0/math.log(16)), math.ceil), res) or [database.config.bits()/4.0])

    for n in res:
        print("[{:{:d}d}] {:>{:d}s} & {:#<{:d}x} ({:d} members){:s}".format(idaapi.get_enum_idx(n), int(cindex), idaapi.get_enum_name(n), maxname, mask(n), int(cmask), len(__builtin__.list(members(n))), " // {:s}".format(comment(n)) if comment(n) else ''))
    return

## members
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号