Format PE — Binaires Windows

Format binaire Windows

Structure PE

DOS Header    : magic "MZ" (4D 5A)
PE Header     : signature "PE\0\0", architecture
Opt. Header   : entrypoint, ImageBase
Section Table : .text, .data, .rdata, .rsrc

Import Address Table (IAT) :
Fonctions importées de DLLs (MessageBoxA, VirtualAlloc...)

.rsrc = ressources (icônes, manifest, strings)

Outils d'analyse

# Statique
PEStudio   : analyse complète, détection malware
DIE / Exeinfo PE  : identifier packer, compilateur
CFF Explorer : éditeur de PE

# Python
import pefile
pe = pefile.PE("binary.exe")
for e in pe.DIRECTORY_ENTRY_IMPORT:
    print(e.dll.decode())
    for i in e.imports:
        print("  " + i.name.decode())