您的位置:首页 > 其它

pwn相关工具的安装全解

2020-02-03 04:38 2226 查看

pwn相关工具的安装全解

主要有:
pwntools,zio
gdb(一些插件)
ROPgadget
one_gadget

1.pwntools,zio

安装pwn题经常用到的库:

#pip先自行安装好
pip install zio

pip install pwn
#若装不上,可以尝试sudo pip install pwn

2.gdb插件的安装:
当 GDB (即 GNU Project Debugger)启动时, 它在当前用户的主目录中寻找一个名为 .gdbinit 的文件; 如果该文件存在, 则 GDB 就执行该文件中的所有命令. 通常, 该文件用于简单的配置命令, 如设置所需的缺省汇编程序格式(Intel® 或 Motorola) 或用于显示输入和输出数据的缺省基数(十进制或十六进制). 它还可以读取宏编码语言, 从而允许实现更强大的自定义. 该语言遵循如下基本格式:

define <command>
<code>
end
document <command>
<help text>
end

插件的安装及配置信息:

2.1 peda

来源:https://github.com/longld/peda
安装:

git clone https://github.com/longld/peda.git ~/peda
echo "source ~/peda/peda.py" >> ~/.gdbinit

意思就是下载完成后, 将 source ~/peda/peda.py 写入 ~/.gdbinit

2.2 gef

来源:https://github.com/hugsy/gef
安装:

#下载 'gef.sh' 并执行
wget -q -O- https://github.com/hugsy/gef/raw/master/gef.sh | sh

#下载 'gef.py', 并将其 'source' 写入 '.gdbinit'
wget -q -O ~/.gdbinit-gef.py https://github.com/hugsy/gef/raw/master/gef.py
echo source ~/.gdbinit-gef.py >> ~/.gdbinit

2.3 pwndbg

安装:

git clone https://github.com/pwndbg/pwndbg
cd pwndbg
sudo #./setup.sh

可能安装会遇到一些问题,比如笔者遇到的pip速度慢的问题,很容易timeout,
可以利用下面的方法解决:

解决pip安装速度慢的问题

国内源
新版ubuntu要求使用https源,要注意。
清华:https://pypi.tuna.tsinghua.edu.cn/simple
阿里云:http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
华中理工大学:http://pypi.hustunique.com/
山东理工大学:http://pypi.sdutlinux.org/
豆瓣:http://pypi.douban.com/simple/

临时使用
可以在使用pip的时候加参数-i https://pypi.tuna.tsinghua.edu.cn/simple

例如:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pwn,这样就会从清华这边的镜像去安装pyspider库。

永久修改
Linux下,修改 ~/.pip/pip.conf (没有就创建一个文件夹及文件。文件夹要加“.”,表示是隐藏文件夹)
内容如下:

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple

[install]
trusted-host=mirrors.aliyun.com

windows下,直接在user目录中创建一个pip目录,如:C:\Users\xx\pip,新建文件pip.ini。内容同上。

2.4 gdbinit配置信息

来源:https://github.com/gdbinit/Gdbinit
安装:

git clone git@github.com:gdbinit/Gdbinit.git
cp Gdbinit/gdbinit ~/.gdbinit

也可以

wget https://raw.githubusercontent.com/gdbinit/Gdbinit/master/gdbinit
cp gbdinit ~/.gdbinit

使用时:
gdb里面三个插件,当你想要用某一个插件的时候,只要输入对应命令就行

使用 peda

echo "source ~/.GdbPlugins/peda/peda.py" > ~/.gdbinit

使用 gef

echo "source ~/.GdbPlugins/gef/gef.py" > ~/.gdbinit

#使用gdbinit
echo "source ~/GdbPlugins/gdbinit/gdbinit" > ~/.gdbinit

使用pwndbg

echo "source ~/.GdbPlugins/pwndbg/gdbinit.py" > ~/.gdbinit

或者vim修改注释即可:vim ~/.gdbinit

3.ROPgadget,one_gadget

来源:
ROPgadget
one_gadget

ROPgadget:
查找可存储寄存器的代码

ROPgadget --binary rop  --only 'pop|ret' | grep 'eax'

查找字符串

ROPgadget --binary rop --string "/bin/sh"

查找有int 0x80的地址

ROPgadget --binary rop  --only 'int'

onegadget:
one-gadget 是glibc里调用execve(’/bin/sh’, NULL, NULL)的一段非常有用的gadget。

安装one_gadget:

sudo apt -y install ruby
sudo gem install one_gadget

4.Libcsearcher

一个基于libc_database写的python库

git clone https://github.com/lieanu/libc.git
cd libc
git submodule update --init --recursive
sudo python setup.py develop

参考:
CTF工具集合安装脚本操作姿势

  • 点赞 2
  • 收藏
  • 分享
  • 文章举报
落殇子诚 发布了5 篇原创文章 · 获赞 10 · 访问量 228 私信 关注
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: