diff options
author | Malfurious <m@lfurio.us> | 2024-01-13 15:03:30 -0500 |
---|---|---|
committer | Malfurious <m@lfurio.us> | 2024-01-13 17:22:12 -0500 |
commit | 221742f7c5c89dc50ec4374bed5d2ccc0d7534bf (patch) | |
tree | 0db3ef432a6f3b06c07060bdb0dd61c7fd164ad2 | |
parent | 67b5a873a2f6f506fc0450fcb22b58f3e6612dc0 (diff) | |
download | nsploit-221742f7c5c89dc50ec4374bed5d2ccc0d7534bf.tar.gz nsploit-221742f7c5c89dc50ec4374bed5d2ccc0d7534bf.zip |
main: Automatically provide top-level sploit modules to user scripts
Signed-off-by: Malfurious <m@lfurio.us>
-rw-r--r-- | sploit/__main__.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sploit/__main__.py b/sploit/__main__.py index 5b694a2..5d53ca6 100644 --- a/sploit/__main__.py +++ b/sploit/__main__.py @@ -46,11 +46,19 @@ 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, {'io': comm, 'print': elog}) + exec(code, user_scope(comm)) ilog("Script Finished!") return except KeyboardInterrupt: |