summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2021-12-15 21:35:18 -0500
committerMalfurious <m@lfurio.us>2021-12-17 22:20:00 -0500
commitdf6be3606022ce72bf543367ffd4f43f6e91c03a (patch)
treec27c3399e40f4e16fedb8db1429aed1360172a4f
parentbe1c5e41d78a8ce8053de6893d19ad100ff75adb (diff)
downloadsploit-df6be3606022ce72bf543367ffd4f43f6e91c03a.tar.gz
sploit-df6be3606022ce72bf543367ffd4f43f6e91c03a.zip
sploit: Catch KeyboardInterrupt in Comm.readall()
If execution is stuck inside readall() (for example, due to blocked IO), handling KeyboardInterrupt allows the user a way to get out, without exiting the active script early or losing the data read so far. Signed-off-by: Malfurious <m@lfurio.us> Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
-rw-r--r--sploit/comm.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/sploit/comm.py b/sploit/comm.py
index afa14e8..789a77e 100644
--- a/sploit/comm.py
+++ b/sploit/comm.py
@@ -31,9 +31,12 @@ class Comm:
def readall(self):
data = b''
- for line in self.back.stdin:
- if self.logonread : ilog(line, file=sys.stdout, color=NORMAL)
- data += line
+ try:
+ for line in self.back.stdin:
+ if self.logonread : ilog(line, file=sys.stdout, color=NORMAL)
+ data += line
+ except KeyboardInterrupt:
+ pass
return data
def readuntil(self, pred, /, *args, **kwargs):