Debug pwn in docker, no need for virtual machines
Did you debug pwn in a virtual machine?
Are you still worried about the virtual machine taking up too much hard disk?
Try this!
Just need to install the basic libraries in docker, you can debug the program as usual!
The docker image will take up very little space.
-
Install docker and docker-compose pwndbg
-
Add your user to docker group.
-
Install requirements:
pip3 install pwntools --user
-
Install pwn-docker-environment.
git clone https://github.com/plusls/pwn-docker-environment.git cd pwn-docker-environment docker-compose up -d
-
Run test script
cd binary python3 test.py
-
You can link
docker_debug.py
to~/.local/lib/{python_version}/site-packages/docker_debug.py
ln -s ~/pwn-docker-environment/docker_debug.py ~/.local/lib/{python_version}/site-packages/docker_debug.py
-
You can add
cp-pwn
script to~/.local/bin
to quick copy binary to dockerexample:
#!/bin/bash cp -r $1 ~/pwn-docker-environment/binary/.
You can use it like this:
cp-pwn ./mybinary
You also can add alias in
.bashrc
alias cp-pwn='_cp_pwn(){ if [ ! -n "$1" ] ;then echo "cp-pwn <filename>";else cp -r $1 ${HOME}/pwn-docker-environment/binary/.; fi}; _cp_pwn'
-
When use windows terminal with wsl2, you can add config to
~/.config/pwn.conf
[context] terminal=['wt.exe', '-w', '0', 'split-pane', 'wsl.exe', '-e'] [update] interval=never
-
When use tmux, you can add config to
~/.config/pwn.conf
[context] terminal=['tmux', 'splitw', '-h'] [update] interval=never