GDB实用插件 peda gef gdbinit 全解

                       


知识共享许可协议
本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可, 转载请注明出处, 谢谢合作

1  GDB插件配置与实用.gdbinit


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

define <command><code>enddocument <command><help text>end
   
   
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 本文并不详细说明 .gdbinit 的语法, 我们只是提供一些从各路大神摘来的配置信息.

  • .gdbinit 的配置繁琐, 因此某些大神想到了用插件的方式来实现, 通过 Python 的脚本可以很方便的实现我们需要的功能

gdb 插件和配置信息


2.1   peda


项目  https://github.com/longld/peda

安装

git clone https://github.com/longld/peda.git ~/pedaecho "source ~/peda/peda.py" >> ~/.gdbinit
   
   
  • 1
  • 2

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

peda

2.2   gef插件


地址 https://github.com/hugsy/gef

安装

# via the install script#下载 `gef.sh` 并执行wget -q -O- https://github.com/hugsy/gef/raw/master/gef.sh | sh# manually# 下载 `gef.py`, 并将其 `source` 写入 `.gdbinit`wget -q -O ~/.gdbinit-gef.py https://github.com/hugsy/gef/raw/master/gef.pyecho source ~/.gdbinit-gef.py >> ~/.gdbinit
   
   
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

可见 gef.sh 的工作其实就是将 gef.py下载下来, 并将环境变量写入 .gdbinit

扫描二维码关注公众号,回复: 6022876 查看本文章

gef

2.3 gdbinit配置信息


我们也可以从网上或自己编写 .gdbinit 配置文件, 我们从网上找到一份配置

地址  https://github.com/gdbinit/Gdbinit

安装

git clone git@github.com:gdbinit/Gdbinit.gitcp Gdbinit/gdbinit ~/.gdbinit
   
   
  • 1
  • 2

或者

wget https://raw.githubusercontent.com/gdbinit/Gdbinit/master/gdbinitcp gbdinit ~/.gdbinit
   
   
  • 1
  • 2

Gdbinit

3  总结


我把前面三个项目组合在一起

地址 : https://github.com/gatieme/GdbPlugins

git clone [email protected]:gatieme/GdbPlugins.git ~/.GdbPlugins
   
   
  • 1

使用

# 使用 pedaecho "source ~/.GdbPlugins/peda/peda.py" > ~/.gdbinit# 使用 gefecho "source ~/.GdbPlugins/gef/gef.py" > ~/.gdbinit#使用 gdbinitecho "source ~/.GdbPlugins/gdbinit/gdbinit" > ~/.gdbinit
   
   
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

4  参考


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

gdb插件gef安装爬坑

知识共享许可协议本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可, 转载请注明出处, 谢谢合作.

           

猜你喜欢

转载自blog.csdn.net/qq_44925149/article/details/89499105
今日推荐