diff options
author | Malfurious <m@lfurio.us> | 2021-12-15 21:35:18 -0500 |
---|---|---|
committer | Malfurious <m@lfurio.us> | 2021-12-17 22:20:00 -0500 |
commit | c7603c3cd00c565d67b6ee08510720934b34ca2e (patch) | |
tree | 1412b2d8ff48345b4ee52b0ac260ee09363dd35e /tools/sploit | |
parent | 09139a3638812ef8ee7f766010729d75ceabad07 (diff) | |
download | lib-des-gnux-c7603c3cd00c565d67b6ee08510720934b34ca2e.tar.gz lib-des-gnux-c7603c3cd00c565d67b6ee08510720934b34ca2e.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>
Diffstat (limited to 'tools/sploit')
-rw-r--r-- | tools/sploit/sploit/comm.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tools/sploit/sploit/comm.py b/tools/sploit/sploit/comm.py index afa14e8..789a77e 100644 --- a/tools/sploit/sploit/comm.py +++ b/tools/sploit/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): |