peutils.py 文件源码

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

项目:srepp_server 作者: SummitRoute 项目源码 文件源码
def generate_section_signatures(self, pe, name, sig_length=512):
        """Generates signatures for all the sections in a PE file.

        If the section contains any data a signature will be created
        for it. The signature name will be a combination of the
        parameter 'name' and the section number and its name.
        """

        section_signatures = list()

        for idx, section in enumerate(pe.sections):

            if section.SizeOfRawData < sig_length:
                continue

            #offset = pe.get_offset_from_rva(section.VirtualAddress)
            offset = section.PointerToRawData

            sig_name = '%s Section(%d/%d,%s)' % (
                name, idx + 1, len(pe.sections),
                ''.join([c for c in section.Name if c in string.printable]))

            section_signatures.append(
                self.__generate_signature(
                    pe, offset, sig_name, ep_only=False,
                    section_start_only=True,
                    sig_length=sig_length) )

        return '\n'.join(section_signatures)+'\n'
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号