CSDN | GitHub |
---|---|
GDB實用插件(peda, gef, gdbinit)全解 | |
本作品采用知識共享署名-非商業性使用-相同方式共享 4.0 國際許可協定進行許可, 轉載請注明出處, 謝謝合作
1 GDB插件配置與實用.gdbinit
當
GDB
(即
GNU Project Debugger
)啟動時, 它在目前使用者的主目錄中尋找一個名為
.gdbinit
的檔案; 如果該檔案存在, 則
GDB
就執行該檔案中的所有指令. 通常, 該檔案用于簡單的配置指令, 如設定所需的預設彙程式設計式格式(
Intel®
或
Motorola
) 或用于顯示輸入和輸出資料的預設基數(十進制或十六進制). 它還可以讀取宏編碼語言, 進而允許實作更強大的自定義. 該語言遵循如下基本格式:
define <command>
<code>
end
document <command>
<help text>
end
- 本文并不詳細說明
的文法, 我們隻是提供一些從各路大神摘來的配置資訊..gdbinit
-
的配置繁瑣, 是以某些大神想到了用插件的方式來實作, 通過.gdbinit
的腳本可以很友善的實作我們需要的功能Python
2 gdb
插件和配置資訊
gdb
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
安裝
# 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.py
echo source ~/.gdbinit-gef.py >> ~/.gdbinit
可見
gef.sh
的工作其實就是将
gef.py
下載下傳下來, 并将環境變量寫入
.gdbinit
2.3 gdbinit配置資訊
我們也可以從網上或自己編寫
.gdbinit
配置檔案, 我們從網上找到一份配置
位址 https://github.com/gdbinit/Gdbinit
安裝
git clone [email protected].com:gdbinit/Gdbinit.git
cp Gdbinit/gdbinit ~/.gdbinit
或者
wget https://raw.githubusercontent.com/gdbinit/Gdbinit/master/gdbinit
cp gbdinit ~/.gdbinit
3 總結
我把前面三個項目組合在一起
位址 : https://github.com/gatieme/GdbPlugins
git clone [email protected]:gatieme/GdbPlugins.git ~/.GdbPlugins
使用
# 使用 peda
echo "source ~/.GdbPlugins/peda/peda.py" > ~/.gdbinit
# 使用 gef
echo "source ~/.GdbPlugins/gef/gef.py" > ~/.gdbinit
#使用 gdbinit
echo "source ~/.GdbPlugins/gdbinit/gdbinit" > ~/.gdbinit
4 參考
CTF工具集合安裝腳本操作姿勢
gdb插件gef安裝爬坑
本作品采用知識共享署名-非商業性使用-相同方式共享 4.0 國際許可協定進行許可, 轉載請注明出處, 謝謝合作.