summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordusoleil <howcansocksbereal@gmail.com>2023-02-26 07:08:37 -0500
committerdusoleil <howcansocksbereal@gmail.com>2023-03-01 13:07:51 -0500
commit4b80ca684eea86fb9e64d6ab5ec606bb403cb4cd (patch)
tree80bf6a8688609484a5bb0e2dc8332fd3cb4b1954
parente3fcc7bf6450bf985291a4d8dd62eb2c08a83245 (diff)
downloadsploit-4b80ca684eea86fb9e64d6ab5ec606bb403cb4cd.tar.gz
sploit-4b80ca684eea86fb9e64d6ab5ec606bb403cb4cd.zip
Add io.last as the result of the last discrete read
Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
-rw-r--r--sploit/comm.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/sploit/comm.py b/sploit/comm.py
index 16a8fa7..e9ea53d 100644
--- a/sploit/comm.py
+++ b/sploit/comm.py
@@ -13,6 +13,7 @@ class Comm:
flushonwrite = True
readonwrite = False
timeout = 250 # milliseconds
+ last = None # result of last discrete read
def __init__(self, backend):
self.back = backend
@@ -28,6 +29,7 @@ class Comm:
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
def readline(self):
@@ -37,6 +39,7 @@ class Comm:
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
def readall(self):
@@ -48,6 +51,7 @@ class Comm:
data += line
except KeyboardInterrupt:
pass
+ self.last = data
return data
def readall_nonblock(self):
@@ -59,7 +63,9 @@ class Comm:
while True:
poll.poll(self.timeout)
d = self.readall()
- if len(d) == 0: return data
+ if len(d) == 0:
+ self.last = data
+ return data
data += d
finally:
os.set_blocking(self.back.stdin.fileno(), True)
@@ -77,6 +83,7 @@ class Comm:
finally:
self.logonread = l
if self.logonread : ilog(data, file=sys.stdout, color=NORMAL)
+ self.last = data
return data
def readlineuntil(self, pred, /, *args, **kwargs):
@@ -86,6 +93,7 @@ class Comm:
dataarr.append(self.readline())
if(pred(dataarr)):
break
+ self.last = dataarr
return dataarr
def write(self, data):