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
commite62f89acb4f8e07c758a0d7e31f96a41776f95c6 (patch)
treef06b75d411f96ea76f872dfb93b14c82e78202df
parenteb7e05d64c8df4ca30b60727b7846ee621e0d920 (diff)
downloadsploit-e62f89acb4f8e07c758a0d7e31f96a41776f95c6.tar.gz
sploit-e62f89acb4f8e07c758a0d7e31f96a41776f95c6.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--sploit/main.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/sploit/main.py b/sploit/main.py
index 6c96104..bd01993 100644
--- a/sploit/main.py
+++ b/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...");