diff options
author | Malfurious <m@lfurio.us> | 2021-12-15 21:20:44 -0500 |
---|---|---|
committer | Malfurious <m@lfurio.us> | 2021-12-17 22:19:55 -0500 |
commit | 09139a3638812ef8ee7f766010729d75ceabad07 (patch) | |
tree | b0506339f392806db8bfde7308fc884df3df21ff | |
parent | 72ae9fd60a4116768eb810a2c961a431da834465 (diff) | |
download | lib-des-gnux-09139a3638812ef8ee7f766010729d75ceabad07.tar.gz lib-des-gnux-09139a3638812ef8ee7f766010729d75ceabad07.zip |
sploit: Ensure the logonread option is restored by Comm.readuntil()
This function has a momentary side-effect of switching self.logonread to
False. This patch ensures its original value is always restored, even
if an exception is raised.
Signed-off-by: Malfurious <m@lfurio.us>
Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
-rw-r--r-- | tools/sploit/sploit/comm.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/tools/sploit/sploit/comm.py b/tools/sploit/sploit/comm.py index 0bc8c6a..afa14e8 100644 --- a/tools/sploit/sploit/comm.py +++ b/tools/sploit/sploit/comm.py @@ -41,11 +41,13 @@ class Comm: pred = bind(pred, *args, **kwargs) l = self.logonread self.logonread = False - while(True): - data += self.read(1) - if(pred(data)): - break - self.logonread = l + try: + while(True): + data += self.read(1) + if(pred(data)): + break + finally: + self.logonread = l if self.logonread : ilog(data, file=sys.stdout, color=NORMAL) return data |