ubuntu18安装各种pwn工具
更换系统镜像为清华镜像源
https://blog.csdn.net/ifreewolf_csdn/article/details/83185505
不换的话以后下载东西会很慢
遇到报错
1 2 | E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable) E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it? |
解决:https://www.cnblogs.com/yun6853992/p/9343816.html
然后重启终端即可,后面还有遇到,直接kill进程,不用再删除文件了
基础工具安装
1 2 3 4 5 6 7 8 | // 安装python $ sudo apt install python //pip $ sudo apt install python-pip //git $ sudo apt install git //gem $ sudo apt install ruby |
先来个放工具的文件夹吧嘿嘿
1 2 | $ mkdir tools $ cd ./tools |
pwntools
在此附上pwntools的官方文档
pwntools支持python >= 2.7
先别用,往下看再自己选择叭!
1 2 3 4 | $ sudo apt-get update $ sudo apt-get install python3 python3-pip python3-dev git libssl-dev libffi-dev build-essential $ sudo python3 -m pip install --upgrade pip $ sudo python3 -m pip install --upgrade git+https://github.com/Gallopsled/pwntools.git@dev3 |
听说这个py3不完备
用别的指令再安装
1 | $ python2 -m pip install pwntools |
gdb
1 | $ sudo apt install gdb |
pwndbg
1 2 3 4 5 | $ mkdir pwndbg
$ git clone https://github.com/pwndbg/pwndbg $ cd pwndbg $ ./setup.sh |
后面有空再下载peda,gef那些吧~
LibcSearcher
1 2 3 | $ git clone https://github.com/lieanu/LibcSearcher.git $ cd LibcSearcher $ python setup.py develop |
使用示例
1 2 3 4 5 6 7 8 9 10 | from LibcSearcher import *
#第二个参数,为已泄露的实际地址,或最后12位(比如:d90),int类型 obj = LibcSearcher("fgets", 0X7ff39014bd90)
obj.dump("system") #system 偏移 obj.dump("str_bin_sh") #/bin/sh 偏移 obj.dump("__libc_start_main_ret")
# sys_addr = libc_base + obj.dump("system") |
如果遇到返回多个libc版本库的情况,可以通过add_condition(leaked_func, leaked_address)来添加限制条件,也可以手工选择其中一个libc版本。
libc-database库的使用
更新数据库
1 | $ ./get |
将自定义libc添加到数据库中
1 | $ ./add /usr/lib/libc-2.21.so |
在数据库中找到在给定地址上具有给定名称的所有libc,仅检查最后12位,因为随机化通常在页面大小级别上进行
1 2 | $ ./find printf 260 puts f30 archive-glibc (id libc6_2.19-10ubuntu2_i386) |
从泄露的返回地址中找到一个libc到__libc_start_main中
1 2 3 4 5 6 | $ ./find __libc_start_main_ret a83 ubuntu-trusty-i386-libc6 (id libc6_2.19-0ubuntu6.6_i386) archive-eglibc (id libc6_2.19-0ubuntu6_i386) ubuntu-utopic-i386-libc6 (id libc6_2.19-10ubuntu2.3_i386) archive-glibc (id libc6_2.19-10ubuntu2_i386) archive-glibc (id libc6_2.19-15ubuntu2_i386) |
给定一个libc ID,转储一些有用的偏移量。您也可以提供自己的名称进行转储。
1 2 3 4 5 6 | $ ./dump libc6_2.19-0ubuntu6.6_i386 offset___libc_start_main_ret = 0x19a83 offset_system = 0x00040190 offset_dup2 = 0x000db590 offset_recv = 0x000ed2d0 offset_str_bin_sh = 0x160a24 |
检查数据库中是否已存在库。
1 2 | $ ./identify /usr/lib/libc.so.6 id local-f706181f06104ef6c7008c066290ea47aa4a82c5 |
下载与libc ID对应的整个库。
1 2 3 4 5 6 7 8 | $ ./download libc6_2.23-0ubuntu10_amd64 Getting libc6_2.23-0ubuntu10_amd64 -> Location: http://security.ubuntu.com/ubuntu/pool/main/g/glibc/libc6_2.23-0ubuntu10_amd64.deb -> Downloading package -> Extracting package -> Package saved to libs/libc6_2.23-0ubuntu10_amd64 $ ls libs/libc6_2.23-0ubuntu10_amd64 ld-2.23.so ... libc.so.6 ... libpthread.so.0 ... |
ROPgadget
1 2 3 4 5 | $ sudo pip install capstone $ ROPgadget.py $ python setup.py install //或者$ pip install ropgadget $ ROPgadget |
用法:
查找可存储寄存器的代码(rop表示二进制文件名)
1 | $ ROPgadget --binary rop --only 'pop|ret' | grep 'eax' |
查找字符串
1 | $ ROPgadget --binary rop --string "/bin/sh" |
查找有int 0x80的地址
1 | $ ROPgadget --binary rop --only 'int' |
--我的出现了这种情况:
发现ROPgadget直接能用,可能忘了什么时候下载过一次?...
one_gadget
1 | $ sudo gem install one_gadget |
roputils
1 | $ git clone https://github.com/inaz2/roputils |
edb-debugger
这就相当于linux的od,用od用惯了,用这个调试就比较好用
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | $ sudo apt-get install cmake $ sudo apt-get install build-essential $ sudo apt-get install libboost-dev $ sudo apt-get install libqt5xmlpatterns5-dev $ sudo apt-get install qtbase5-dev $ sudo apt-get install qt5-default $ sudo apt-get install libqt5svg5-dev $ sudo apt-get install libgraphviz-dev $ sudo apt-get install libcapstone-dev //以上其实可以写在一条命令行。。。
$ git clone --recursive https://github.com/eteran/edb-debugger $ cd edb-debugger $ mkdir build $ cd build $ cmake .. $ make $ ./edb |
转载:https://bbs.pediy.com/thread-258437-1.htm