summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordusoleil <howcansocksbereal@gmail.com>2021-09-01 02:38:45 -0400
committerdusoleil <howcansocksbereal@gmail.com>2021-09-01 02:38:45 -0400
commit2b69b26652c63a7e8f681b1b0d7b75d21180a896 (patch)
tree6e2b83e85739ab402b244e23b7ea9c20c89b779c
parente409f0953fcdc1e570871a7e37548fcd9340bb70 (diff)
downloadsploit-2b69b26652c63a7e8f681b1b0d7b75d21180a896.tar.gz
sploit-2b69b26652c63a7e8f681b1b0d7b75d21180a896.zip
readlineuntil() Operates on an Array of Lines
Instead of only operating on and returning the last line read, readlineuntil() will now check the predicate against an array of all lines read and return that array when the predicate is true. Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
-rw-r--r--sploit/comm.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/sploit/comm.py b/sploit/comm.py
index 9a20318..f7d2f5d 100644
--- a/sploit/comm.py
+++ b/sploit/comm.py
@@ -28,17 +28,22 @@ class Comm:
def readuntil(self, pred):
data = b''
- while(not pred(data)):
+ while(True):
data += self.back.stdin.read(1)
+ if(pred(data)):
+ break
log(data)
return data
def readlineuntil(self, pred):
- data = b''
- while(not pred(data)):
+ dataarr = []
+ while(True):
data = self.back.stdin.readline()
log(data)
- return data
+ dataarr.append(data)
+ if(pred(dataarr)):
+ break
+ return dataarr
def write(self, data):
self.back.stdout.write(data)