summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordusoleil <howcansocksbereal@gmail.com>2021-09-02 04:33:38 -0400
committerdusoleil <howcansocksbereal@gmail.com>2021-09-02 04:33:38 -0400
commit98a68415ee658194f586dce4d14ce2918cc537f6 (patch)
tree0c368e08be7e22ac137eef288bb9ce9d0312e124
parentda2af8c7a93f528a225672ebfae652ebfc6a78bf (diff)
downloadlib-des-gnux-98a68415ee658194f586dce4d14ce2918cc537f6.tar.gz
lib-des-gnux-98a68415ee658194f586dce4d14ce2918cc537f6.zip
Reuse read() and readline() in the until() API
Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
-rw-r--r--tools/sploit/sploit/comm.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/sploit/sploit/comm.py b/tools/sploit/sploit/comm.py
index 223b639..81efa9c 100644
--- a/tools/sploit/sploit/comm.py
+++ b/tools/sploit/sploit/comm.py
@@ -38,10 +38,13 @@ class Comm:
def readuntil(self, pred, /, *args, **kwargs):
data = b''
pred = bind(pred, *args, **kwargs)
+ l = self.logonread
+ self.logonread = False
while(True):
- data += self.back.stdin.read(1)
+ data += self.read(1)
if(pred(data)):
break
+ self.logonread = l
if self.logonread : log(data)
return data
@@ -49,9 +52,7 @@ class Comm:
dataarr = []
pred = bind(pred, *args, **kwargs)
while(True):
- data = self.back.stdin.readline()
- if self.logonread : log(data)
- dataarr.append(data)
+ dataarr.append(self.readline())
if(pred(dataarr)):
break
return dataarr