首页
社区
课程
招聘
[原创]ubuntu18安装各种pwn工具
2020-3-28 14:37 17778

[原创]ubuntu18安装各种pwn工具

2020-3-28 14:37
17778

写在前面:
因为18就没怎么用过,所以很多东西都没有下载安装,连很基础的指令都没得...18炸了又重装

更换系统镜像为清华镜像源

https://blog.csdn.net/ifreewolf_csdn/article/details/83185505
不换的话以后下载东西会很慢

 

遇到报错

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进程,不用再删除文件了

基础工具安装

// 安装python
$ sudo apt install python
//pip
$ sudo apt install python-pip
//git
$ sudo apt install git
//gem
$ sudo apt install ruby

先来个放工具的文件夹吧嘿嘿

$ mkdir tools
$ cd ./tools

pwntools

在此附上pwntools的官方文档
pwntools支持python >= 2.7
先别用,往下看再自己选择叭!

$ 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不完备
我丢,用南梦gg给的指令再安装

$ python2 -m pip install pwntools

gdb

$ sudo apt install gdb

pwndbg

$ mkdir pwndbg

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

后面有空再下载pedagef那些吧~

LibcSearcher

$ git clone https://github.com/lieanu/LibcSearcher.git
$ cd LibcSearcher
$ python setup.py develop

使用示例

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库的使用

更新数据库

$ ./get

将自定义libc添加到数据库中

$ ./add /usr/lib/libc-2.21.so

在数据库中找到在给定地址上具有给定名称的所有libc,仅检查最后12位,因为随机化通常在页面大小级别上进行

$ ./find printf 260 puts f30
archive-glibc (id libc6_2.19-10ubuntu2_i386)

从泄露的返回地址中找到一个libc到__libc_start_main中

$ ./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,转储一些有用的偏移量。您也可以提供自己的名称进行转储。

$ ./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

检查数据库中是否已存在库。

$ ./identify /usr/lib/libc.so.6
id local-f706181f06104ef6c7008c066290ea47aa4a82c5

下载与libc ID对应的整个库。

$ ./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

$ sudo pip install capstone
$ ROPgadget.py
$ python setup.py install
//或者$ pip install ropgadget
$ ROPgadget

用法:

 

查找可存储寄存器的代码(rop表示二进制文件名)

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

查找字符串

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

查找有int 0x80的地址

$ ROPgadget --binary rop --only 'int'

--我的出现了这种情况:

 

 

发现ROPgadget直接能用,可能忘了什么时候下载过一次?...

one_gadget

$ sudo gem install one_gadget

roputils

$ git clone https://github.com/inaz2/roputils

edb-debugger

这就相当于linux的od,用od用惯了,用这个调试就比较好用

$ 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

[培训]《安卓高级研修班(网课)》月薪三万计划,掌握调试、分析还原ollvm、vmp的方法,定制art虚拟机自动化脱壳的方法

收藏
点赞2
打赏
分享
最新回复 (3)
雪    币: 3539
活跃值: (911)
能力值: ( LV6,RANK:80 )
在线值:
发帖
回帖
粉丝
smartdon 1 2020-3-31 09:06
2
0
不错,对我这种想入门的很友好
雪    币: 5
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
mb_kugwraep 2020-4-1 23:02
3
0
很详细
最后于 2020-4-1 23:02 被mb_kugwraep编辑 ,原因:
雪    币: 12129
活跃值: (15560)
能力值: ( LV12,RANK:240 )
在线值:
发帖
回帖
粉丝
pureGavin 2 2020-10-22 16:25
4
0
少了pwnscripts的安装,虽然这工具用的人不多
游客
登录 | 注册 方可回帖
返回