Pull ubuntu 16.04 from docker hub
‘–cap-add=SYS_PTRACE –security-opt seccomp=unconfined’ make sure your gdb can attach your process with permission.
1 2
| docker pull ubuntu:16.04 docker run --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -i -t --name create_env ubuntu:16.04 bash
|
Some useful packages
1 2 3 4
| apt-get install -y software-properties-common apt-get install vim apt-get install git apt-get install wget
|
Install gdb
1 2 3 4 5 6 7 8 9 10 11
| # install python3
apt-get install python3 apt-get -y install python3-pip
# install pwntool3
apt-get update apt-get install python3 python3-pip python3-dev git libssl-dev libffi-dev build-essential python3 -m pip install --upgrade pip python3 -m pip install --upgrade git+https://github.com/Gallopsled/pwntools.git@dev
|
Install peda
1 2 3
| git clone https://github.com/longld/peda.git ~/peda echo "source ~/peda/peda.py" >> ~/.gdbinit echo "DONE! debug your program with gdb and enjoy"
|
Start your environment
assume your container ID is ba286abaed92.
1 2
| docker container start ba286abaed92 docker exec -i -t ba286abaed92 bash
|
Trouble shooting
ptrace: Operation not permitted
rebuild your env with ‘–cap-add=SYS_PTRACE –security-opt seccomp=unconfined’.
x64 can’t support running 32(bits) code
install i386 arch:
1 2 3
| sudo dpkg --add-architecture i386 sudo apt-get update sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386
|