objectif
Modifier un header ou un octet spécifique d’un fichier binaire en place.
code minimal
# écrire 0x01 0x02 à l'offset 0x10
printf '\x01\x02' | dd of=app.bin bs=1 seek=$((0x10)) conv=notrunc
utilisation
# sauvegarde puis patch
cp app.bin app.bin.bak
printf '\x00' | dd of=app.bin bs=1 seek=7 conv=notrunc
variante(s) utile(s)
# remplacer une séquence via xxd/patch
xxd -p app.bin | sed 's/^00000010: ..../00000010: 0102/' > hexdump.patch
notes
conv=notruncévite de tronquer le fichier.- attention aux offsets; validez avec
xxd -g1 -c16.