From 2b69b26652c63a7e8f681b1b0d7b75d21180a896 Mon Sep 17 00:00:00 2001 From: dusoleil Date: Wed, 1 Sep 2021 02:38:45 -0400 Subject: 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 --- sploit/comm.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'sploit/comm.py') 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) -- cgit v1.2.3