diff options
author | Malfurious <m@lfurio.us> | 2023-02-17 17:17:00 -0500 |
---|---|---|
committer | dusoleil <howcansocksbereal@gmail.com> | 2023-02-18 14:06:25 -0500 |
commit | 73c0b2de35f9077b03073523a67463d75d63c201 (patch) | |
tree | 06f5d4dcfd3b6a7a25380a3aefdab6f29903ab8a | |
parent | 94ee3d4e87c9f5b3714dfe5c3ecee5c280a320ff (diff) | |
download | sploit-73c0b2de35f9077b03073523a67463d75d63c201.tar.gz sploit-73c0b2de35f9077b03073523a67463d75d63c201.zip |
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 <m@lfurio.us>
Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
-rw-r--r-- | sploit/main.py | 5 |
1 files 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) |