Ubuntu 18.04.5安装pwntools

Ubuntu 18.04.5版本,镜像是清华源上下载的,系统用的是阿里源(不知道怎么换源的可以看我的另一篇https://blog.csdn.net/qq_49914719/article/details/111597207)

首先安装git

sudo apt-get install git

结果报错了
Ubuntu 18.04.5安装pwntools

ph4ntom@ubuntu:~$ sudo apt-get install git
[sudo] ph4ntom 的密码: 
E: 无法获得锁 /var/lib/dpkg/lock-frontend - open (11: 资源暂时不可用)
E: 无法获取 dpkg 前端锁 (/var/lib/dpkg/lock-frontend),是否有其他进程正占用它?

两行代码解决

sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock-frontend

然后继续安装git

sudo apt-get install python-pip

安装/更新pip

sudo apt-get install python2.7 python-pip python-dev git libssl-dev libffi-dev build-essential
pip install --upgrade pip

安装setuptools

pip install setuptools
pip list

安装pwntools

sudo pip install --upgrade pwntools
sudo apt-get install python-dev

最后测试一下pwntools

python
from pwn import*
asm("xor eax,eax")
asm(shellcraft.sh())

输出如下

ph4ntom@ubuntu:~$ python
Python 2.7.17 (default, Sep 30 2020, 13:38:04) 
[GCC 7.5.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pwn import*
>>> asm("xor eax,eax")
'1\xc0'
>>> asm(shellcraft.sh())
'jhh///sh/bin\x89\xe3h\x01\x01\x01\x01\x814$ri\x01\x011\xc9Qj\x04Y\x01\xe1Q\x89\xe11\xd2j\x0bX\xcd\x80'
>>> 

安装完成

参考链接:
https://www.cnblogs.com/ctf-pwn-player/p/10710031.html
https://blog.csdn.net/dream_follower/article/details/90311799

上一篇:BUUCTF-RE-pyre


下一篇:【python】字节转换 base64 encode decode pickle