pefile.py 文件源码

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

项目:Reverse-Engineering-Arsenal 作者: vallejocc 项目源码 文件源码
def dump_dict(self):
        """Returns a dictionary representation of the structure."""

        dump_dict = dict()

        dump_dict['Structure'] = self.name

        # Refer to the __set_format__ method for an explanation
        # of the following construct.
        for keys in self.__keys__:
            for key in keys:

                val = getattr(self, key)
                if isinstance(val, (int, long)):
                    if key == 'TimeDateStamp' or key == 'dwTimeStamp':
                        try:
                            val = '0x%-8X [%s UTC]' % (val, time.asctime(time.gmtime(val)))
                        except exceptions.ValueError as e:
                            val = '0x%-8X [INVALID TIME]' % val
                else:
                    val = b([b for b in val if b != 0])

                dump_dict[key] = {'FileOffset': self.__field_offsets__[key] + self.__file_offset__,
                                  'Offset': self.__field_offsets__[key],
                                  'Value': val}

        return dump_dict
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号