summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordusoleil <howcansocksbereal@gmail.com>2021-09-01 00:25:47 -0400
committerdusoleil <howcansocksbereal@gmail.com>2021-09-01 00:32:56 -0400
commit6943f13dc906bdf411bcddebcaf243006addaceb (patch)
tree885868d8f0ed41e818f6fc7d3be75d8e229bfe22
parent4ad55bd63722303ae642dd955d9496c41c8fb681 (diff)
downloadlib-des-gnux-6943f13dc906bdf411bcddebcaf243006addaceb.tar.gz
lib-des-gnux-6943f13dc906bdf411bcddebcaf243006addaceb.zip
Handle Exceptions in Daemon Mode
If the user presses Ctrl+C while waiting on a connection, we want to gracefully exit. If the user presses Ctrl+C during the script, we want to stop executing the script and restart the loop. If any other exception happens during the script, we want to print out the stacktrace as normal, but continue the loop. Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
-rw-r--r--tools/sploit/sploit/main.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/tools/sploit/sploit/main.py b/tools/sploit/sploit/main.py
index 6c96104..bd01993 100644
--- a/tools/sploit/sploit/main.py
+++ b/tools/sploit/sploit/main.py
@@ -1,5 +1,6 @@
import argparse
import tempfile
+import traceback
from sploit.comm import *
@@ -30,7 +31,17 @@ def daemon(script):
print("Running in Pipe Daemon Mode...")
with tempfile.TemporaryDirectory() as tmpdir:
while(True):
- runscript(script,Comm(Pipes(tmpdir)));
+ try:
+ p = Pipes(tmpdir)
+ except KeyboardInterrupt:
+ break
+ try:
+ runscript(script,Comm(p));
+ except KeyboardInterrupt:
+ pass
+ except:
+ traceback.print_exc()
+ del p
def pipe(script):
print("Running in Pipe Mode...");