From e409f0953fcdc1e570871a7e37548fcd9340bb70 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 --- sploit/comm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sploit/comm.py b/sploit/comm.py index fc220ef..9a20318 100644 --- a/sploit/comm.py +++ b/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