summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2022-03-10 05:13:12 -0500
committerMalfurious <m@lfurio.us>2022-03-14 00:15:10 -0400
commitf62515b19c848d5020e4e0e06c13c33e0a1af5bb (patch)
tree5e6534d0587c0df3888d5e2b8e7bb1e046337939
parent554e159ab80dfe4f8e504209de3c95f4929aa5aa (diff)
downloadlib-des-gnux-f62515b19c848d5020e4e0e06c13c33e0a1af5bb.tar.gz
lib-des-gnux-f62515b19c848d5020e4e0e06c13c33e0a1af5bb.zip
sploit: Add function popen()
This is a free-function in the comm module, intended to help setup Sploit plumbing when working in the Python interactive interpreter. At the moment, the intended user experience in the interpreter is to err on the side of being interactive/responsive. As such, the Comm object returned from popen() is initialized with overridden IO settings to prefer 'readonwrite' by default. Addtionally, any early output from the target is also read, so that it may be immediately visible. A consequence of this configuration is that, until readonwrite is set False, most target output will be consumed before any .read* function has a chance to return it. While that would be a hard showstopper for any Sploit script, an interactive user can simply copy/paste any important data that is produced. Given that the interpreter workflow is likely going to be most useful for quick prototyping and recon with the proposed rev module, I consider this tradeoff appropriate at the moment, but will consider revisiting this if its usage is problematic. Signed-off-by: Malfurious <m@lfurio.us> Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
-rw-r--r--tools/sploit/sploit/comm.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/sploit/sploit/comm.py b/tools/sploit/sploit/comm.py
index c109ec4..3972f16 100644
--- a/tools/sploit/sploit/comm.py
+++ b/tools/sploit/sploit/comm.py
@@ -124,6 +124,12 @@ class Comm:
os.set_blocking(stdin.fileno(), True)
ilog("<--Interact Mode Done-->")
+def popen(cmdline=''):
+ io = Comm((Process(cmdline.split()) if len(cmdline) > 0 else Pipes()))
+ io.readall_nonblock()
+ io.readonwrite = True
+ return io
+
class Process:
def __init__(self, args):
ilog(f"Running: {' '.join(args)}")