Facebook
From moi, 1 Year ago, written in Python.
This paste is a reply to oui from moi - view diff
Embed
Download Paste or View Raw
Hits: 115
  1. import pefile
  2.  
  3. def extract_raw_from_pe(pe_path, output_path):
  4.     # Charger le fichier PE
  5.     pe = pefile.PE(pe_path)
  6.  
  7.     # Extraire le code machine brut
  8.     raw_data = bytearray()
  9.     for section in pe.sections:
  10.         raw_data += section.get_data()
  11.  
  12.     # Enregistrer le code machine brut dans un fichier binaire
  13.     with open(output_path, 'wb') as output_file:
  14.         output_file.write(raw_data)
  15.  
  16. if __name__ == "__main__":
  17.     # Spécifier le chemin vers le fichier PE x64
  18.     pe_path = "path/to/your/file.exe"
  19.  
  20.     # Spécifier le chemin de sortie pour le fichier brut (raw)
  21.     output_path = "output/raw_code.raw"
  22.  
  23.     # Appeler la fonction d'extraction
  24.     extract_raw_from_pe(pe_path, output_path)
  25.  

Replies to Re: oui rss

Title Name Language When
Re: Re: oui moi python 1 Year ago.
captcha