From 73c0b2de35f9077b03073523a67463d75d63c201 Mon Sep 17 00:00:00 2001 From: Malfurious Date: Fri, 17 Feb 2023 17:17:00 -0500 Subject: Always shutdown comms after executing script Moving this io cleanup code to the finally block allows it to also run when recovering from an exception. This prevents cases where the target may hang if the user sploit script crashes, and avoids requiring the user to press an additonal CTRL-C to move on. Signed-off-by: Malfurious Signed-off-by: dusoleil --- sploit/main.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sploit/main.py b/sploit/main.py index b0fe3eb..0f949f9 100644 --- a/sploit/main.py +++ b/sploit/main.py @@ -48,13 +48,14 @@ def runscript(script, comm): code = compile(open(script).read(), script, 'exec') exec(code, {'io': comm, 'print': elog}) ilog("Script Finished!") - comm.shutdown() - comm.readall() return except KeyboardInterrupt: pass except: ilog(traceback.format_exc(), end='', color=ERROR) finally: + comm.shutdown() + comm.readall() gc.collect() + ilog("Script Ended Early!", color=WARNING) -- cgit v1.2.3