Static
Static
import pefile
import capstone
import math
import csv
from collections import Counter
# Caract�ristiques statiques
file_data.update(extract_pe_header(pe))
file_data['Imports'] = ",".join(extract_imports(pe))
file_data['Exports'] = ",".join(extract_exports(pe))
file_data['Entropy'] = calculate_entropy(pe.__data__)
file_data['ByteHistogram'] = ",".join(map(str,
extract_byte_histogram(pe.__data__)))
file_data['Opcodes'] = ",".join(extract_opcodes(pe))
# Sections PE
for i, section_info in enumerate(extract_sections(pe), 1):
for key, value in section_info.items():
file_data[f'Section_{i}_{key}'] = value
malware_data.append(file_data)
except Exception as e:
print(f"Erreur lors du traitement de {filename}: {e}")