sample_cleaning_demo/is_PETest.py

16 lines
447 B
Python
Raw Normal View History

2023-05-12 11:20:02 +08:00
import pefile
def is_pe_file(file_path):
try:
pe = pefile.PE(file_path)
return True
except pefile.PEFormatError:
return False
if __name__ == '__main__':
file_path = r'C:\Users\Administrator\Desktop\大规模复杂软件无效样本清洗\demo1\Test - 副本\新建 文本文档 (2).txt'
if is_pe_file(file_path):
print('The file is a PE file')
else:
print('The file is not a PE file')