structure.py 文件源码

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

项目:idascripts 作者: ctfhacker 项目源码 文件源码
def list(self, **type):
        """List all the members within the structure.

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

        escape = repr
        maxindex = max(__builtin__.map(utils.compose(operator.attrgetter('index'),"{:d}".format,len), res) or [1])
        maxoffset = max(__builtin__.map(utils.compose(operator.attrgetter('offset'),"{:x}".format,len), res) or [1])
        maxsize = max(__builtin__.map(utils.compose(operator.attrgetter('size'),"{:x}".format,len), res) or [1])
        maxname = max(__builtin__.map(utils.compose(operator.attrgetter('name'), escape, len), res) or [1])
        maxtype = max(__builtin__.map(utils.compose(operator.attrgetter('type'), repr, len), res) or [1])

        for m in res:
            print "[{:{:d}d}] {:>{:d}x}:+{:<{:d}x} {:<{:d}s} {:{:d}s} (flag={:x},dt_type={:x}{:s}){:s}".format(m.index, maxindex, m.offset, int(maxoffset), m.size, maxsize, escape(m.name), int(maxname), m.type, int(maxtype), m.flag, m.dt_type, '' if m.typeid is None else ",typeid={:x}".format(m.typeid), " // {:s}".format(m.comment) if m.comment else '')
        return
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号