-
Notifications
You must be signed in to change notification settings - Fork 15
/
test_unpack_pe.py
36 lines (27 loc) · 1.55 KB
/
test_unpack_pe.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import os, logging
logging.basicConfig(level=logging.DEBUG)
os.chdir(os.path.join(os.path.dirname(__file__),'tests'))
TEMP_OUTPUT_FILENAME = '_unpacked.exe'
def unpack_exec(pe_file, **kw):
from evbunpack.__main__ import main
main(pe_file, 'output', os.path.join('.',TEMP_OUTPUT_FILENAME), **kw)
return_code = os.system(TEMP_OUTPUT_FILENAME)
if return_code != 0:
logging.error('Failed to execute unpacked file. Exit code: %d', return_code)
return return_code
def test_unpack10_80_x64():
assert unpack_exec('x64_PackerTestApp_packed_20240613.exe', legacy_fs = False, pe_variant = '10_70') == 0
def test_unpack10_70_x64():
assert unpack_exec('x64_PackerTestApp_packed_20240522.exe', legacy_fs = False, pe_variant = '10_70') == 0
def test_unpack9_70_x64():
assert unpack_exec('x64_PackerTestApp_packed_20210329.exe', legacy_fs = False, pe_variant = '9_70') == 0
def test_unpack7_80_x64():
assert unpack_exec('x64_PackerTestApp_packed_20170713.exe', legacy_fs = True, pe_variant = '7_80') == 0
def test_unpack10_80_x86():
assert unpack_exec('x86_PackerTestApp_packed_20240613.exe', legacy_fs = False, pe_variant = '10_70') == 0
def test_unpack10_70_x86():
assert unpack_exec('x86_PackerTestApp_packed_20240522.exe', legacy_fs = False, pe_variant = '10_70') == 0
def test_unpack9_70_x86():
assert unpack_exec('x86_PackerTestApp_packed_20210329.exe', legacy_fs = False, pe_variant = '9_70') == 0
def test_unpack7_80_x86():
assert unpack_exec('x86_PackerTestApp_packed_20170713.exe', legacy_fs = True, pe_variant = '7_80') == 0