From efce48cddf1a44c40cafaabf60861b23b290946b Mon Sep 17 00:00:00 2001 From: Heap Crash <66139157+heapcrash@users.noreply.github.com> Date: Sun, 28 Feb 2021 22:47:04 -0500 Subject: [PATCH] [gdb] Add a timeout to GDB faketerminal operations (#1836) --- pwnlib/gdb_faketerminal.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pwnlib/gdb_faketerminal.py b/pwnlib/gdb_faketerminal.py index 5717efff6..1e594892d 100755 --- a/pwnlib/gdb_faketerminal.py +++ b/pwnlib/gdb_faketerminal.py @@ -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()