From 1130206afaf5a4cf192c8cb3626ed475930b07bb Mon Sep 17 00:00:00 2001 From: dusoleil Date: Sat, 18 Feb 2023 14:33:14 -0500 Subject: 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 --- sploit/comm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) -- cgit v1.2.3