Skip to content

Commit

Permalink
[gdb] Add a timeout to GDB faketerminal operations (#1836)
Browse files Browse the repository at this point in the history
  • Loading branch information
heapcrash committed Mar 1, 2021
1 parent 19cf23b commit efce48c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pwnlib/gdb_faketerminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
from os import environ
sleep(1)
if len(argv) == 2:
sh = process(argv[1], shell=True)
sh = process(argv[1], shell=True, timeout=30)
else:
sh = process(argv[1:])
sh = process(argv[1:], timeout=30)
sh.sendline('set prompt (gdb)')
if environ.get('GDB_FAKETERMINAL') == '0':
sh.sendline('set pagination off')
sh.recvall()
else:
res = sh.sendlineafter('(gdb)', 'c')
while b'The program is not being run.' not in res:
while res and b'The program is not being run.' not in res:
res = sh.sendlineafter('(gdb)', 'c')
sh.close()

0 comments on commit efce48c

Please sign in to comment.