summaryrefslogtreecommitdiffstats
path: root/tools/sploit
diff options
context:
space:
mode:
Diffstat (limited to 'tools/sploit')
-rw-r--r--tools/sploit/sploit/comm.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/sploit/sploit/comm.py b/tools/sploit/sploit/comm.py
index 604045c..4b1d487 100644
--- a/tools/sploit/sploit/comm.py
+++ b/tools/sploit/sploit/comm.py
@@ -11,6 +11,7 @@ class Comm:
logonread = True
logonwrite = False
flushonwrite = True
+ timeout = 0.25 # seconds
def __init__(self, backend):
self.back = backend
@@ -42,6 +43,16 @@ class Comm:
pass
return data
+ def readall_nonblock(self):
+ try:
+ os.set_blocking(self.back.stdin.fileno(), False)
+ poll = select.poll()
+ poll.register(self.back.stdin, select.POLLIN)
+ poll.poll(self.timeout)
+ return self.readall()
+ finally:
+ os.set_blocking(self.back.stdin.fileno(), True)
+
def readuntil(self, pred, /, *args, **kwargs):
data = b''
pred = bind(pred, *args, **kwargs)