记Ubuntu 20.04环境搭建

前言

提前写好pwn环境搭建留给学弟学妹?

正文

vm虚拟机安装

首先上ubuntu官网下载iso文件,接着用vm新建即可。(省略)

换源

首先是换源,参考地址

在terminal中输入:

1
2
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bck
sudo gedit /etc/apt/sources.list

然后在弹出的文本中内容替换为如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

然后保存即可。

然后再在terminal中输入:

1
sudo apt update

这样即可完成换源并更新。

安装python和pip及pip换源

ubuntu20已经安装好了python3,不过习惯直接输入python打开,所以输入如下命令即可:

1
sudo apt install python-is-python3

这样就可以直接输入python来运行python3了。

接着输入如下命令安装pip:

1
sudo apt install python3-pip

换源(参考地址):

直接在terminal中输入如下命令即可

1
sudo pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

安装pwntools

直接运行:

1
sudo pip3 install pwntools

PS:现在感觉都好容易,当年的,都是泪啊。

安装pwndbg

官方网址

在terminal中输入如下命令:

1
2
3
git clone https://github.com/pwndbg/pwndbg
cd pwndbg
./setup.sh

即可完成安装。

注:

运行setup.sh前,需修改以下内容:

​ 1.将setup.sh中的第24行的sudo apt-get -y install python-pip || true,修改为#sudo apt-get -y install python-pip || true

​ 2.修改requirements.txt为如下内容:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
future
isort!=4.3.0
pip
psutil>=3.1.0
pycparser
pyelftools
python-ptrace>=0.8
ROPgadget
six
pygments
capstone==4.0.1
enum34
pytest
testresources

至此pwn的基础环境便安装完成了。