From ffad0c5afbdc7968bb8d9de7d5ec017284dee45f Mon Sep 17 00:00:00 2001 From: dusoleil Date: Wed, 1 Sep 2021 00:10:11 -0400 Subject: Better Shutdown Process for Target Program If we need to wait on the target program to die, we don't want to just wait forever with no indication to the user. Instead, only call wait if the program is still alive, inform the user that we are doing this, and give them the ability to forcefully kill the target program with Ctrl+C. Signed-off-by: dusoleil --- tools/sploit/sploit/comm.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/sploit/sploit/comm.py b/tools/sploit/sploit/comm.py index f9c3a38..d3b1395 100644 --- a/tools/sploit/sploit/comm.py +++ b/tools/sploit/sploit/comm.py @@ -103,7 +103,14 @@ class Process: self.stdout = self.proc.stdin def __del__(self): - self.proc.wait() + if(self.proc.poll() != None): + return + try: + print("Waiting on Target Program to End...") + print("Press Ctrl+C to Forcefully Kill It...") + self.proc.wait() + except KeyboardInterrupt: + self.proc.kill() class Pipes: def __init__(self,tmp=None): -- cgit v1.2.3