我正在尝试使用 pwntools 来控制 python3 会话。这是我的代码:
from pwn import process
r = process(['python3'])
r.interactive()
但是,我进入后r.interactive()
,在终端输入时,python3子进程有奇怪的反应。至少我大部分时间都没有看到我的命令得到回应。
我也试图打电话给python3
一个bash
会话,但同样的事情发生了。
$ python3
Python 3.8.5 (default, Jan 27 2021, 15:41:15)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pwn import process
>>> r = process(['bash'])
[x] Starting local process '/usr/bin/bash'
[+] Starting local process '/usr/bin/bash': pid 119080
>>> r.interactive()
[*] Switching to interactive mode
echo hello
hello
echo this is bash
this is bash
python3
print(1)
print(2)
print(3)
exit
echo hello
File "<stdin>", line 5
echo hello
^
SyntaxError: invalid syntax
为什么会这样?它是 pwntools 中的错误,还是我忽略了一些配置?