diff options
author | dusoleil <howcansocksbereal@gmail.com> | 2021-09-01 05:56:31 -0400 |
---|---|---|
committer | dusoleil <howcansocksbereal@gmail.com> | 2021-09-01 05:56:31 -0400 |
commit | d78a5ad4bd97dde7cb87084580ade729ebdece7d (patch) | |
tree | 283f38411e8b192b7521b14a518d20b59765232f /tools/sploit | |
parent | 4b4279a18fb144213883af90977137a23fb507e5 (diff) | |
download | lib-des-gnux-d78a5ad4bd97dde7cb87084580ade729ebdece7d.tar.gz lib-des-gnux-d78a5ad4bd97dde7cb87084580ade729ebdece7d.zip |
Add Config Toggles for Read/Write Extra Behavior
logonread can enable/disable logging the result of every read
flushonwrite can enable/disable automatically flushing every write
Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
Diffstat (limited to 'tools/sploit')
-rw-r--r-- | tools/sploit/sploit/comm.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/tools/sploit/sploit/comm.py b/tools/sploit/sploit/comm.py index 037516f..a0a9ebd 100644 --- a/tools/sploit/sploit/comm.py +++ b/tools/sploit/sploit/comm.py @@ -11,18 +11,21 @@ class Comm: def __init__(self, backend): self.back = backend + logonread = True + flushonwrite = True + def read(self, size): data = os.read(self.back.stdin.fileno(), size) if(data == b''): raise BrokenPipeError('Tried to read on broken pipe') - log(data) + if self.logonread : log(data) return data def readline(self): data = self.back.stdin.readline() if(data == b''): raise BrokenPipeError('Tried to read on broken pipe') - log(data) + if self.logonread : log(data) return data def readuntil(self, pred, /, *args, **kwargs): @@ -32,7 +35,7 @@ class Comm: data += self.back.stdin.read(1) if(pred(data)): break - log(data) + if self.logonread : log(data) return data def readlineuntil(self, pred, /, *args, **kwargs): @@ -40,7 +43,7 @@ class Comm: pred = bind(pred, *args, **kwargs) while(True): data = self.back.stdin.readline() - log(data) + if self.logonread : log(data) dataarr.append(data) if(pred(dataarr)): break @@ -48,7 +51,7 @@ class Comm: def write(self, data): self.back.stdout.write(data) - self.back.stdout.flush() + if self.flushonwrite : self.back.stdout.flush() def writeline(self, data): self.write(data + b'\n') |