import pefile def extract_raw_from_pe(pe_path, output_path): # Charger le fichier PE pe = pefile.PE(pe_path) # Extraire le code machine brut raw_data = bytearray() for section in pe.sections: raw_data += section.get_data() # Enregistrer le code machine brut dans un fichier binaire with open(output_path, 'wb') as output_file: output_file.write(raw_data) if __name__ == "__main__": # Spécifier le chemin vers le fichier PE x64 pe_path = "path/to/your/file.exe" # Spécifier le chemin de sortie pour le fichier brut (raw) output_path = "output/raw_code.raw" # Appeler la fonction d'extraction extract_raw_from_pe(pe_path, output_path)