pwnでsocatを使って環境を作る[備忘録]

socatを使うとPwnを解く際にリモート環境を再現してくれる。

socatを実行

socat tcp-listen:4088,reuseaddr,fork, exec:./main.sh

main.shの中身

r30n@M0C0:~/workspace/binary/2016_08_03/Production/ctf_study2/2.hands-on$ cat main.sh 
gdbserver localhost:1234 ./ropasaurusrex

netcatでアクセス

nc localhost:4088

gdbを起動

gdb -x cmd

cmdの中身

r30n@M0C0:~/workspace/binary/2016_08_03/Production/ctf_study2/2.hands-on$ cat cmd 
file ./ropasaurusrex
target remote localhost:1234
b *0x8048416
c