1. 首页
  2. 技术小贴

CTF-PWN 环境配置

pwntools

技术小贴
技术小贴
  • sudo apt install python-pip python3-pip
  • sudo pip install pwntools
    • 提示安装python-dev可以使用aptitude安装
    • 这一步建议挂代理
  • python
>>> import pwn
>>> pwn.asm("xor eax,eax")
'1\xc0'
#安装成功

pwndgb

gef

peda

ROPgadget

one_gadget

  • 寻找libc文件中的一些shell地址
  • gem install one_gadget

切换脚本

#!/bin/bash
function Mode_change {
	name=$1
	gdbinitfile=/root/.gdbinit    #这个路径按照你的实际情况修改
	
	peda="source ~/peda/peda.py"   #这个路径按照你的实际情况修改
	gef="source ~/gef/gef.py"      #这个路径按照你的实际情况修改
	pwndbg="source /root/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}i
	parameter_del=${location}d
 
	message="TEST"
 
	if [ $name -eq "1" ];then
		sed -i "$parameter_del" $gdbinitfile
		sed -i "$parameter_add $peda" $gdbinitfile
		echo -e "Please enjoy the peda!\n"
	elif [ $name -eq "2" ];then
		sed -i "$parameter_del" $gdbinitfile
		sed -i "$parameter_add $gef" $gdbinitfile
		echo -e "Please enjoy the gef!\n"
	else
		sed -i "$parameter_del" $gdbinitfile
		sed -i "$parameter_add $pwndbg" $gdbinitfile
		echo -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:" num
if [ $num -eq "1" ];then
	Mode_change $num
elif [ $num -eq "2" ];then
	Mode_change $num
elif [ $num -eq "3" ];then
	Mode_change $num
else
	echo -e "Error!\nPleasse input right number!"
fi
 
gdb $1 $2 $3 $4 $5 $6 $7 $8 $9

zsh

  • apt-get install zsh
  • git clone https://github.com/robbyrussell/oh-my-zsh.git
  • cd oh-my-zsh/tools
  • ./install.sh
  • 下载安装 zsh-autosuggestions (自动补全可能路径)
  • vi ~/.zshrc
  • plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
  • source .zshrc
  • 改变默认shell
    • chsh -s /bin/zsh

原创文章,作者:小嵘源码,如若转载,请注明出处:https://www.lcpttec.com/ctf-pwn/

联系我们

176-888-72082

在线咨询:点击这里给我发消息

邮件:2668888288@qq.com

工作时间:周一至周五,9:00-18:00,节假日休息

QR code