From c394b31ecbcc78682629ef20b552de32e2ac3e9e Mon Sep 17 00:00:00 2001 From: dusoleil Date: Wed, 1 Sep 2021 01:08:06 -0400 Subject: Correct read() Semantics The BufferedReader's .read() doesn't behave as expected. It reads EXACTLY size bytes and will block until there are enough available to read. os.read() does what we expect. It will read UP TO size bytes and only block if there is nothing available to read. Signed-off-by: dusoleil --- tools/sploit/sploit/comm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools/sploit') diff --git a/tools/sploit/sploit/comm.py b/tools/sploit/sploit/comm.py index fc220ef..9a20318 100644 --- a/tools/sploit/sploit/comm.py +++ b/tools/sploit/sploit/comm.py @@ -13,7 +13,7 @@ class Comm: self.back = backend def read(self, size): - data = self.back.stdin.read(size) + data = os.read(self.back.stdin.fileno(), size) if(data == b''): raise BrokenPipeError('Tried to read on broken pipe') log(data) -- cgit v1.2.3