diff options
author | Malfurious <m@lfurio.us> | 2022-03-10 05:13:12 -0500 |
---|---|---|
committer | Malfurious <m@lfurio.us> | 2022-03-14 00:15:10 -0400 |
commit | b1f3c291e50b72b23813d32e9b6f4dfeefbd2527 (patch) | |
tree | 479e5abc4e19229daeac487b392704fdafbd6843 | |
parent | 5d388a4f47272c612413961938692d1d28030fc8 (diff) | |
download | sploit-b1f3c291e50b72b23813d32e9b6f4dfeefbd2527.tar.gz sploit-b1f3c291e50b72b23813d32e9b6f4dfeefbd2527.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-- | sploit/comm.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sploit/comm.py b/sploit/comm.py index c109ec4..3972f16 100644 --- a/sploit/comm.py +++ b/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)}") |