I'm trying to close the process if the process has stopped writing lines (meaning the program has crashed, in this specific case because the process will always be printing lines).
but when I do line = proc.stdout.readline().decode("utf-8")
and then the process is hanging not printing anything to stdout, stderr, then my while loop isn't getting looped over.. I would like to do this so I can detect when ffuf is hanging, and then after 10 seconds of the process continuously hanging I will kill the process
tl;dr #If there is no more lines being printed by ffuf, the while loop will not get hit even if go_next_domain is True
with open("riot.txt") as f:
for f_line in f:
f_line = f_line.rstrip("\n\r")
proc = subprocess.Popen(['ffuf', f_line], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
go_next_domain = False
start_time = time.time()
last_line_recieved = time.time()
print("Bruteforcing", f_line)
while not go_next_domain:
print(proc.stdout.readable())
line = proc.stdout.readline().decode("utf-8")