summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sploit/comm.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/sploit/comm.py b/sploit/comm.py
index e9ea53d..8078c9f 100644
--- a/sploit/comm.py
+++ b/sploit/comm.py
@@ -24,10 +24,15 @@ class Comm:
except BrokenPipeError:
pass
- def read(self, size):
- data = self.back.stdin.read(size)
- if(data == b''):
- raise BrokenPipeError('Tried to read on broken pipe')
+ def read(self, size=-1):
+ if size < 0:
+ return self.readall_nonblock()
+ elif size == 0:
+ data = b''
+ else:
+ 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)
self.last = data
return data