diff options
| author | dusoleil <howcansocksbereal@gmail.com> | 2021-09-02 04:33:38 -0400 | 
|---|---|---|
| committer | dusoleil <howcansocksbereal@gmail.com> | 2021-09-02 04:33:38 -0400 | 
| commit | a5e26e02746a46c6a0a793de4006faa7c4df9793 (patch) | |
| tree | 5107f37f61fe7a3204cdc59a2ea6dd0081e08076 | |
| parent | ad0e943147ac6fb724f8f57fd83d65f90e20ba05 (diff) | |
| download | nsploit-a5e26e02746a46c6a0a793de4006faa7c4df9793.tar.gz nsploit-a5e26e02746a46c6a0a793de4006faa7c4df9793.zip  | |
Reuse read() and readline() in the until() API
Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
Diffstat (limited to '')
| -rw-r--r-- | sploit/comm.py | 9 | 
1 files changed, 5 insertions, 4 deletions
diff --git a/sploit/comm.py b/sploit/comm.py index 223b639..81efa9c 100644 --- a/sploit/comm.py +++ b/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  | 
