From 1357d6e8db621f08c4660beb2e73ea0921c1f80d Mon Sep 17 00:00:00 2001 From: Malfurious Date: Sun, 12 Dec 2021 02:51:50 -0500 Subject: sploit: Remove -d/--daemon option A couple of facts have influenced the decision to remove this option: - If a sploit script uses a shebang to launch sploit, it is tricky to specify this option. Specifically, one must add it to their shebang line, which couples more information to the script than was originally intended. - Single-pass pipe mode wasn't all that useful. One can accomplish the same thing by running pipe-daemon, and it is easy to exit after one iteration. Electing to run normal pipe mode requires you to know you only want to run once, which is much more common when running via direct subprocess. As a result of this change, running in pipe mode will now be equivalent to the previous pipe-daemon mode, and subprocess target mode remains single pass. Signed-off-by: Malfurious Signed-off-by: dusoleil --- sploit/main.py | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/sploit/main.py b/sploit/main.py index 77ef49e..8456029 100644 --- a/sploit/main.py +++ b/sploit/main.py @@ -1,48 +1,35 @@ -import argparse +from argparse import ArgumentParser, REMAINDER +import gc import tempfile import traceback -import gc from sploit.comm import * def main(): - parser = argparse.ArgumentParser(description='Execute Sploit Script Against Target') - parser.add_argument('-d', '--daemon', action='store_true', - help='run in "daemon" mode with pipes instead of a designated target') - parser.add_argument('script', - help='exploit script to run') - parser.add_argument('target', nargs=argparse.REMAINDER, - help='target program to exploit') + parser = ArgumentParser(description='Execute Sploit script against target') + parser.add_argument('script', help='Exploit script to run') + parser.add_argument('target', nargs=REMAINDER, help='Target program to exploit') args = parser.parse_args() if(len(args.target)>0): - if(args.daemon): - print("Target Given. Ignoring Daemon Flag...") target(args.script, args.target) else: - if(args.daemon): - daemon(args.script) - else: - pipe(args.script) + pipe(args.script) -def daemon(script): - print("Running in Pipe Daemon Mode...") +def pipe(script): + print("Running in Pipe Mode...") with tempfile.TemporaryDirectory() as tmpdir: while(True): try: p = Pipes(tmpdir) except KeyboardInterrupt: break - runscript(script, Comm(p)); + runscript(script, Comm(p)) del p -def pipe(script): - print("Running in Pipe Mode..."); - runscript(script, Comm(Pipes())); - def target(script, target): print("Running in Target Mode...") - runscript(script, Comm(Process(target))); + runscript(script, Comm(Process(target))) def runscript(script, comm): try: -- cgit v1.2.3