日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

PWN中的gdb调试, pwndbg,peda,gef 切换使用的方法;

發布時間:2025/3/20 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 PWN中的gdb调试, pwndbg,peda,gef 切换使用的方法; 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
peda 用來做逆向破解是最方便的 gef 用來 debug 最好 pwndbg 做pwn題很方便

當你把三款調試工具裝完之后,他們不能同時使用,并且他們的切換也不方便

三個插件的下載

Peda

git clone https://github.com/longld/peda.git ~/peda echo "source ~/peda/peda.py" >> ~/.gdbinit

Gef

wget -q -O- https://github.com/hugsy/gef/raw/master/gef.sh | sh wget -q -O ~/.gdbinit-gef.py https://github.com/hugsy/gef/raw/master/gef.py echo source ~/.gdbinit-gef.py >> ~/.gdbinit

Pwndbg

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

方法一:

輸入命令 vim ~/.gdbinit


發現已經添加好了 pwn peda, gef 的路徑

沒有的話自己手動添加一下

當你想使用pwndbg時把其他的注釋掉就可以了,想使用peda時同理;

方法二:用腳本切換

有一種腳本可以代替我們手動切換,就方便了許多,方法如下:

尋找環境變量路徑:echo $PATH


使用命令 touch gdb.sh 新建一個文件

順便可以看看權限,能不能執行,不能的話加上權限 chmod 700 gdb.sh

#!/bin/bash function Mode_change {name=$1gdbinitfile=/home/zzh/.gdbinit #這個路徑按照你的實際情況修改peda="source ~/peda/peda.py" #這個路徑按照你的實際情況修改gef="source ~/.gdbinit-gef.py" #這個路徑按照你的實際情況修改pwndbg="source /home/zzh/pwndbg/gdbinit.py"sign=$(cat $gdbinitfile | grep -n "#this place is controled by user's shell")#此處上面的查找內容要和你自己的保持一致pattern=":#this place is controled by user's shell"number=${sign%$pattern}location=$[number+2]parameter_add=${location}iparameter_del=${location}dmessage="TEST"if [ $name -eq "1" ];thensed -i "$parameter_del" $gdbinitfilesed -i "$parameter_add $peda" $gdbinitfileecho -e "Please enjoy the peda!\n"elif [ $name -eq "2" ];thenecho -e "Please enjoy the gef!\n"elsesed -i "$parameter_del" $gdbinitfilesed -i "$parameter_add $pwndbg" $gdbinitfileecho -e "Please enjoy the pwndbg!\n"fi}echo -e "Please choose one mode of GDB?\n1.peda 2.gef 3.pwndbg"read -p "Input your choice:" numif [ $num -eq "1" ];thenMode_change $num elif [ $num -eq "2" ];thenMode_change $num elif [ $num -eq "3" ];thenMode_change $num elseecho -e "Error!\nPleasse input right number!" figdb $1 $2 $3 $4 $5 $6 $7 $8 $9

這樣就基本完成了;


這個腳本只是用代碼,代替了我們手動更改.gdbinit文件,就方便了許多

總結

以上是生活随笔為你收集整理的PWN中的gdb调试, pwndbg,peda,gef 切换使用的方法;的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。