From 074a15310b8bbeeeeb00bf5ab5877c12f1ca1861 Mon Sep 17 00:00:00 2001 From: Malfurious Date: Fri, 12 Jan 2024 16:26:03 -0500 Subject: log: Move to sploit.util package Signed-off-by: Malfurious --- sploit/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sploit/main.py') diff --git a/sploit/main.py b/sploit/main.py index 6d71196..0d022f2 100644 --- a/sploit/main.py +++ b/sploit/main.py @@ -5,7 +5,7 @@ import tempfile import traceback from sploit.comm import * -from sploit.log import * +from sploit.util.log import * from sploit import __version__ def print_banner(color, line1=__version__, line2='', line3=''): -- cgit v1.2.3 From 03e1f242f69903fcd132010228259231301b3f43 Mon Sep 17 00:00:00 2001 From: Malfurious Date: Sat, 13 Jan 2024 08:45:40 -0500 Subject: comm: Promote from module to package This is done to help clean the top-level "sploit" package. Furthermore, there is some planned future work to refactor comm into multiple modules, so this lays some groundwork for that. Signed-off-by: Malfurious --- sploit/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sploit/main.py') diff --git a/sploit/main.py b/sploit/main.py index 0d022f2..5fd5192 100644 --- a/sploit/main.py +++ b/sploit/main.py @@ -4,7 +4,7 @@ from os.path import isdir import tempfile import traceback -from sploit.comm import * +from sploit.comm.comm import * from sploit.util.log import * from sploit import __version__ -- cgit v1.2.3 From d051f6d7daa4e0c025dcb58af392cca47c6019d7 Mon Sep 17 00:00:00 2001 From: Malfurious Date: Sat, 13 Jan 2024 09:26:09 -0500 Subject: Remove extra "main.py" file The CLI logic is moved to sploit/__main__.py. This file is now the target of: - python -m sploit - sploit.py (via import) - sploit (installed executable - via pyproject.toml) A module guard (`if __name__ == "__main__"`) is added to allow the application to run when this file is invoked directly. And the entrypoint symlink is no longer necessary. Signed-off-by: Malfurious --- sploit/main.py | 65 ---------------------------------------------------------- 1 file changed, 65 deletions(-) delete mode 100644 sploit/main.py (limited to 'sploit/main.py') diff --git a/sploit/main.py b/sploit/main.py deleted file mode 100644 index 5fd5192..0000000 --- a/sploit/main.py +++ /dev/null @@ -1,65 +0,0 @@ -from argparse import ArgumentParser, REMAINDER -import gc -from os.path import isdir -import tempfile -import traceback - -from sploit.comm.comm import * -from sploit.util.log import * -from sploit import __version__ - -def print_banner(color, line1=__version__, line2='', line3=''): - ilog() - ilog(' ░▒█▀▀▀█░▒█▀▀█░▒█░░░░▒█▀▀▀█░▀█▀░▀▀█▀▀ ', end='', color=ALT) - ilog(line1, color=ALT) - ilog(' ░░▀▀▀▄▄░▒█▄▄█░▒█░░░░▒█░░▒█░▒█░░░▒█░░ ', end='', color=color) - ilog(line2, color=ALT) - ilog(' ░▒█▄▄▄█░▒█░░░░▒█▄▄█░▒█▄▄▄█░▄█▄░░▒█░░ ', end='', color=ALT) - ilog(line3, color=ALT) - ilog() - -def main(): - 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 cmdline or pipes directory') - args = parser.parse_args() - - if len(args.target) == 0: - with tempfile.TemporaryDirectory() as tmpdir: - pipe(args.script, tmpdir) - elif len(args.target) == 1 and isdir(args.target[0]): - pipe(args.script, args.target[0]) - else: - target(args.script, args.target) - -def pipe(script, tmpdir): - print_banner(ERROR, line3='Pipe Mode') - while True: - try: - p = Pipes(tmpdir) - except KeyboardInterrupt: - break - runscript(script, Comm(p)) - del p - -def target(script, target): - print_banner(STATUS, line3='Subprocess Mode') - runscript(script, Comm(Process(target))) - -def runscript(script, comm): - try: - ilog("Running Script...") - code = compile(open(script).read(), script, 'exec') - exec(code, {'io': comm, 'print': elog}) - ilog("Script Finished!") - return - except KeyboardInterrupt: - pass - except: - ilog(traceback.format_exc(), end='', color=ERROR) - finally: - comm.shutdown() - comm.readall() - gc.collect() - - ilog("Script Ended Early!", color=WARNING) -- cgit v1.2.3