備忘録

備忘録

dd でバイナリを書き換える

f:id:kagasu:20160906083530p:plain

前提条件

UNIX系シェルで動作します。
Windowsの場合はBash on Ubuntu on Windowsがインストールされていること。

方法

1. 以下のコマンドを実行すると、
「0x465C0」に「0x01, 0x02, 0x03, 0x04」が書き込まれます。

printf '\x01\x02\x03\x04' | dd of=test.exe bs=1 seek=$((0x465C0)) count=4 conv=notrunc