From df6be3606022ce72bf543367ffd4f43f6e91c03a Mon Sep 17 00:00:00 2001 From: Malfurious Date: Wed, 15 Dec 2021 21:35:18 -0500 Subject: 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 Signed-off-by: dusoleil --- sploit/comm.py | 9 ++++++--- 1 file 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): -- cgit v1.2.3