summaryrefslogtreecommitdiffstats
path: root/sploit/__main__.py
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2025-01-02 19:17:34 -0500
committerMalfurious <m@lfurio.us>2025-01-04 23:54:51 -0500
commit0f00627964a4b2e515108401fa2cfe94600ad648 (patch)
tree56da2ccaf393a1124220cc187a7225a4efcfbcba /sploit/__main__.py
parent640726aa11369d328c1cdfe00b4344b6a925729c (diff)
downloadnsploit-0f00627964a4b2e515108401fa2cfe94600ad648.tar.gz
nsploit-0f00627964a4b2e515108401fa2cfe94600ad648.zip
Rename sploit package to nsploit
Rename all affected files, references to file paths, and module imports within the code. Since this line of development represents a fork from the original sploit, a name change is seen as necessary to distinguish the projects, as well as allow them to be installed side by side. What does the "n" mean? Great question! You can think of it as meaning "new sploit" if you want, though that's not quite intended. The name is simply distinct and easy to pronounce. I had originally settled on "msploit" (something along the lines of "Malf's sploit"), but this name is too close to "metasploit" for me - and N is right next to it on the keyboard. Signed-off-by: Malfurious <m@lfurio.us>
Diffstat (limited to 'sploit/__main__.py')
-rw-r--r--sploit/__main__.py77
1 files changed, 0 insertions, 77 deletions
diff --git a/sploit/__main__.py b/sploit/__main__.py
deleted file mode 100644
index 5d53ca6..0000000
--- a/sploit/__main__.py
+++ /dev/null
@@ -1,77 +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 user_scope(comm):
- import sploit as lib
- scope = { name: getattr(lib, name) for name in dir(lib) }
- scope['__version__'] = __version__
- scope['print'] = elog
- scope['io'] = comm
- return scope
-
-def runscript(script, comm):
- try:
- ilog("Running Script...")
- code = compile(open(script).read(), script, 'exec')
- exec(code, user_scope(comm))
- 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)
-
-
-if __name__ == "__main__":
- main()