diff options
author | dusoleil <howcansocksbereal@gmail.com> | 2023-02-18 14:33:14 -0500 |
---|---|---|
committer | dusoleil <howcansocksbereal@gmail.com> | 2023-02-18 14:33:14 -0500 |
commit | 1130206afaf5a4cf192c8cb3626ed475930b07bb (patch) | |
tree | 94a982d567a6da98bd70392da4b5da17feedff66 | |
parent | 5fc3b61980e3f964b4d3834d31844ccb76986ba4 (diff) | |
download | sploit-1130206afaf5a4cf192c8cb3626ed475930b07bb.tar.gz sploit-1130206afaf5a4cf192c8cb3626ed475930b07bb.zip |
Use buffered read throughout Comm
We had originally decided to use the os.read() function instead of the
actual buffered file object's read function. This was due to the
blocking behavior or os.read() being closer to POSIX read than the other
function.
As it turns out, os.read() is an unbuffered read. Every other read call
in this interface is buffered. This causes some undefined behavior in
certain cases and leads to some really confusing bugs.
After some discussion, we've decided that, in this application's domain,
the blocking behavior of the buffered file object's read is actually
often more useful anyways. Changing this call will deal with both
issues.
Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
-rw-r--r-- | sploit/comm.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sploit/comm.py b/sploit/comm.py index 8c46f1d..41eae60 100644 --- a/sploit/comm.py +++ b/sploit/comm.py @@ -24,7 +24,7 @@ class Comm: pass def read(self, size): - data = os.read(self.back.stdin.fileno(), size) + data = self.back.stdin.read(size) if(data == b''): raise BrokenPipeError('Tried to read on broken pipe') if self.logonread : ilog(data, file=sys.stdout, color=NORMAL) |