summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2022-04-08 23:44:49 -0400
committerMalfurious <m@lfurio.us>2022-04-08 23:44:49 -0400
commit83a7e196cfcefee11e9bed6542b2dd5954b3d055 (patch)
treed7feb42202bbf46e995edc000f99d88fb071857e
parent9b91175045c4dc6e2c3d1d83433f9569495fcb9f (diff)
parent93c6adcbc97f6cdd9b45b78b95279abb82e8a05c (diff)
downloadlib-des-gnux-83a7e196cfcefee11e9bed6542b2dd5954b3d055.tar.gz
lib-des-gnux-83a7e196cfcefee11e9bed6542b2dd5954b3d055.zip
Merge branch 'sploit/interactive-fixes'
These patches correct some issues I've run into using the interactive workflow in Sploit during picoCTF. * sploit/interactive-fixes: sploit: Allow multiple reads in Comm.readall_nonblock() sploit: Fix units for Comm.timeout
-rw-r--r--tools/sploit/sploit/comm.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/tools/sploit/sploit/comm.py b/tools/sploit/sploit/comm.py
index 265ab96..67c97bc 100644
--- a/tools/sploit/sploit/comm.py
+++ b/tools/sploit/sploit/comm.py
@@ -12,7 +12,7 @@ class Comm:
logonwrite = False
flushonwrite = True
readonwrite = False
- timeout = 0.25 # seconds
+ timeout = 250 # milliseconds
def __init__(self, backend):
self.back = backend
@@ -46,11 +46,15 @@ class Comm:
def readall_nonblock(self):
try:
+ data = b''
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()
+ while True:
+ poll.poll(self.timeout)
+ d = self.readall()
+ if len(d) == 0: return data
+ data += d
finally:
os.set_blocking(self.back.stdin.fileno(), True)