本文主要介绍利用ubuntu搭建pwn做题环境,包括pwntools,gdb,gdb-pwndbg,gdb-peda,libc库等
$ sudo apt-get update
$ sudo apt-get install python2.7 python-pip python-dev git libssl-dev libffi-dev build-essential
$ sudo pip install --upgrade pip
$ sudo pip install --upgrade pwntools
需要注意的是,安装过程中如果报“error in cryptography setup command: Invalid environment marker: python_version < ‘3’”这个错误,解决方法:
$ pip install --upgrade setuptools
安装后可以通过在python中输入from pwn import * 来验证是否安装成功
$ sudo apt-get install gcc gdb
这里要注意,要想peda和pwndbg共存,要先安装pwndbg再安装peda,若已安装peda,想再安装pwndbg,需调整gdbinit文件中source路径的顺序
$ git clone https://github.com/pwndbg/pwndbg
$ cd pwndbg
$ sudo ./setup.sh
$ git clone https://github.com/longld/peda.git ~/peda
$ echo "source ~/peda/peda.py" >> ~/.gdbinit
$ git clone https://github.com/niklasb/libc-database.git
$ ./get