enum.py 文件源码

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

项目:idascripts 作者: ctfhacker 项目源码 文件源码
def by(**type):
    """Search through all the enumerations within the database and return the first result.

    like = glob match
    regex = regular expression
    index = particular index
    identifier or id = internal id number
    """
    searchstring = ', '.join("{:s}={!r}".format(k,v) for k,v in type.iteritems())

    res = __builtin__.list(iterate(**type))
    if len(res) > 1:
        map(logging.info, ("[{:d}] {:s} & {:#x} ({:d} members){:s}".format(idaapi.get_enum_idx(n), idaapi.get_enum_name(n), mask(n), len(__builtin__.list(members(n))), " // {:s}".format(comment(n)) if comment(n) else '') for i,n in enumerate(res)))
        logging.warn("{:s}.search({:s}) : Found {:d} matching results, returning the first one.".format(__name__, searchstring, len(res)))

    res = next(iter(res), None)
    if res is None:
        raise LookupError("{:s}.search({:s}) : Found 0 matching results.".format(__name__, searchstring))
    return res
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号