我正在创建一个脚本,它将启动一些线程,并在二进制文件上运行输入。用法是python3 script.py binary input.txt
。这是遇到此错误的可重现段:
from pwn import *
import threading
inputFile = ""
try:
inputFile = open(sys.argv[2], 'r')
inputStr = inputFile.read().strip()
inputFile.close()
except OSError:
sys.exit()
def run(testStr) :
p = process("./"+sys.argv[1])
p.sendline(testStr)
p.shutdown()
return p.poll(block = True)
def opens() :
while True:
run(inputStr)
for i in range(0,10):
thread = threading.Thread(target = opens)
thread.start()
运行 5 秒左右后,我遇到了这个错误,以及错误:out of pty devices
. 我在 ubuntu 20.04 上运行。