Update main.py

Potential fix for #187
This commit is contained in:
Tib3rius 2023-01-16 00:42:52 -05:00
parent 851ffbd316
commit 9cfbc4a7ce
1 changed files with 10 additions and 6 deletions

View File

@ -49,8 +49,8 @@ else:
warn('It looks like the plugins in ' + config['data_dir'] + ' are outdated. Please remove the ' + config['data_dir'] + ' directory and re-run AutoRecon to rebuild them.')
# Save current terminal settings so we can restore them.
terminal_settings = termios.tcgetattr(sys.stdin.fileno())
# Saves current terminal settings so we can restore them.
terminal_settings = None
autorecon = AutoRecon()
@ -121,9 +121,9 @@ def cancel_all_tasks(sig, frame):
if len(alive) > 0:
error('The following process IDs could not be killed: ' + ', '.join([str(x.pid) for x in sorted(alive, key=lambda x: x.pid)]))
if not config['disable_keyboard_control']:
# Restore original terminal settings.
if terminal_settings is not None:
termios.tcsetattr(sys.stdin.fileno(), termios.TCSADRAIN, terminal_settings)
async def start_heartbeat(target, period=60):
@ -1513,6 +1513,9 @@ async def run():
start_time = time.time()
if not config['disable_keyboard_control']:
terminal_settings = termios.tcgetattr(sys.stdin.fileno())
pending = []
i = 0
while autorecon.pending_targets:
@ -1616,6 +1619,7 @@ async def run():
if not config['disable_keyboard_control']:
# Restore original terminal settings.
if terminal_settings is not None:
termios.tcsetattr(sys.stdin, termios.TCSADRAIN, terminal_settings)
def main():