gdb常用命令(转)

pwn常常会用到gdb,看到一篇不错的文章,记录了很多命令:https://www.jianshu.com/p/c3e5f5972b21

gdb

基础调试命令
s step,si步入
n 执行下一条指令 ni步入
b 在某处下断点,可以用
b * adrress
b function_name
info b 查看断点信息
delete 删除所有断点
c 继续
r 执行
disas addr 查看addr处前后的反汇编代码
disas functions 参看fucntion函数的反汇编代码

 

显示内存数据

p 系列
p system/main 显示某个函数地址
p $esp 显示寄存器
p/x p/a p/b p/s。。。
p 0xff - 0xea 计算器
print &VarName 查看变量地址
p * 0xffffebac 查看某个地址处的值

x系列
命令格式:x/<n/f/u> <addr> 
n是一个正整数,表示需要显示的内存单元的个数
f 表示显示的格式(b字符,s字符串,i汇编指令,x十六进制,d十进制)
u 表示从当前地址往后请求的字节数 默认4byte,u参数可以用下面的字符来代替,b表示单字节,h表示双字节,w表示四字 节,g表示八字节
<addr>表示一个内存地址
x/xw addr 显示某个地址处开始的16进制内容,如果有符号表会加载符号表
x/x $esp 查看esp寄存器中的值
x/s addr 查看addr处的字符串
x/b addr 查看addr处的字符
x/i addr 查看addr处的反汇编结果

info系列
info register $ebp 查看寄存器ebp中的内容 (简写为 i r ebp)
i r eflags 查看状态寄存器
i r ss 查看段寄存器
i b 查看断点信息
i functions 查看所有的函数
disas addr 查看addr处前后的反汇编代码
stack 20 查看栈内20个值
show args 查看参数
vmmap 查看映射状况 peda带有
readelf 查看elf文件中各个段的起始地址 peda带有
parseheap 显示堆状况 peda带有

 

查找数据

find 查找字符串 peda带有
searchmem 查找字符串 peda带有
ropsearch "xor eax,eax;ret" 0x08048080 0x08050000 查找某段的rop peda带有
ropgadget 提供多个pop|ret可行结果 peda带有

 

pwngdb插件

libc : Print the base address of libc
ld : Print the base address of ld
codebase : Print the base of code segment
heap : Print the base of heap
got : Print the Global Offset Table infomation
dyn : Print the Dynamic section infomation
findcall : Find some function call
bcall : Set the breakpoint at some function call
tls : Print the thread local storage address
at : Attach by process name
findsyscall : Find the syscall
fmtarg : Calculate the index of format string
You need to stop on printf which has vulnerability.
force : Calculate the nb in the house of force.
heapinfo :打印heap的一些信息
default is the arena of current thread
If tcache is enable, it would show infomation of tcache entry
heapinfoall : Print some infomation of heap (all threads)
arenainfo : Print some infomation of all arena
chunkptr : 打印chunk的信息 后面加chunk返回给用户的地址
printfastbin : 打印fastbin的链表信息
tracemalloc on : 追踪程序chunk的malloc和free
parseheap :解析堆的布局
magic : 打印出glibc中一些有用的信息
fp : show FILE structure
fp (Address of FILE)
fpchain: show linked list of FILE
orange : Test house of orange condition in the _IO_flush_lockp
orange (Address of FILE)
glibc version <= 2.23

 

pwndbg

top_chunk: 显示top chunk的信息
malloc_chunk address:打印出已被分配的chunk的信息
fastbins:显示fastbins链表信息
unsorted:显示unsortedbin 的信息
smallbins:显示smallbins的信息
largebins:显示largebins的信息
bins:显示所有bins的信息
mp:显示一些内存管理用到的全局变量
arena:显示分配区的信息

 

posted @ 2020-06-12 13:18  一点涵  阅读(871)  评论(0编辑  收藏  举报