summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2021-09-04 21:42:55 -0400
committerMalfurious <m@lfurio.us>2021-09-05 05:59:50 -0400
commit0f73c14e0837978abf29f2e6a84c67e5f2e11795 (patch)
treeb237c53f2c1b22ffa79ce1a603ad0606628ca5ce
parentc215cc471e88dfa697f1a255d5342120e18b3e10 (diff)
downloadlib-des-gnux-0f73c14e0837978abf29f2e6a84c67e5f2e11795.tar.gz
lib-des-gnux-0f73c14e0837978abf29f2e6a84c67e5f2e11795.zip
sploit: Properly scope user-script execution
Rather than implicitly inheriting names in scope for the user-script, this collection is sanitized and we only export the 'comm' communication object. This seems to be a safer way to operate and addresses an issue with sub-scopes in the user's script not functioning properly. (Previously, user-defined functions did not have access to globals, or library functions.) Additionally, the user's code is now passed through compile() to attach the original file name. This is useful for debugging / diagnostic situations, to make it more obvious if a crash originated from the user's script. Signed-off-by: Malfurious <m@lfurio.us> Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
-rw-r--r--tools/sploit/sploit/main.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/sploit/sploit/main.py b/tools/sploit/sploit/main.py
index 0bc799e..4697715 100644
--- a/tools/sploit/sploit/main.py
+++ b/tools/sploit/sploit/main.py
@@ -53,7 +53,7 @@ def target(script, target):
def runscript(script, comm):
print("Running Script...")
- exec(open(script).read())
+ code = compile(open(script).read(), script, 'exec')
+ exec(code, {'comm': comm})
print("Script Finished!")
comm.readall()
-