一、问题描述
在通过ssh连接服务器,在命令行界面进行pwntools的实验中,在调用gdb进行debug时会报这样一个错
[ERROR] Could not find a terminal binary to use. Set context.terminal to your terminal,如下图所示
其中部分实验代码如下:
from pwn import *
sh = process('./leakmemory')
...
gdb.attach(sh)
...
经过对源码的分析,我们知道是脚本在第9行调用gdb对sh进程进行debug时,需要新开一个终端,也就是说在前面对新开终端的参数进行设置(即context.terminal=[])。
一开始我到/usr/bin下找类似terminal、gnome-terminal的指令,因为我本能的就将context.terminal=['gnome-terminal','sh',-x]进行设置,然后运行脚本的时候发现程序卡在waiting for debugger的进度,最后发现这个服务器并没有安装gnome...都ssh连接了...
二、解决办法
使用tmux。
1、在gdb.attach()命令行之前加一句:
context.terminal = ['tmux','splitw','-h']</