From 94d353f7d700c5a591d64d2b22613e04f52622b3 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 --- tools/sploit/sploit/comm.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'tools/sploit') diff --git a/tools/sploit/sploit/comm.py b/tools/sploit/sploit/comm.py index 9a20318..f7d2f5d 100644 --- a/tools/sploit/sploit/comm.py +++ b/tools/sploit/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