pefile_test.py 文件源码

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

项目:pefile-tests 作者: viper-framework 项目源码 文件源码
def test_nt_headers_exception(self):
        """pefile should fail parsing invalid data (missing NT headers)"""

        # Take a known good file.
        control_file = os.path.join(REGRESSION_TESTS_DIR, 'MSVBVM60.DLL')
        pe = pefile.PE(control_file, fast_load=True)

        # Truncate it at the PE header and add invalid data.
        pe_header_offest = pe.DOS_HEADER.e_lfanew
        corrupted_data = pe.__data__[:pe_header_offest] + b'\0' * (1024 * 10)

        self.assertRaises(pefile.PEFormatError, pefile.PE, data=corrupted_data)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号