diff --git a/dllhook/main.py b/dllhook/main.py index a87311f..45bdc45 100644 --- a/dllhook/main.py +++ b/dllhook/main.py @@ -27,7 +27,7 @@ def main(): args = parser.parse_args() exe_path = args.exe - script_path = args.python_script + script_path = os.path.abspath(args.python_script) pid = subprocess.Popen(exe_path).pid injector_path = os.path.join(SCRIPT_DIR, 'mayhem', 'tools', 'python_injector.py') @@ -38,12 +38,11 @@ def main(): else: envs['PATH'] = INTERPRETER_DIR - f = tempfile.NamedTemporaryFile(suffix='.py', delete=False) - formatted_script = injected_script.format(working_dir=os.path.abspath(os.curdir), - import_path=script_path).encode('utf8') + with tempfile.NamedTemporaryFile(suffix='.py', delete=False) as f: + formatted_script = injected_script.format(working_dir=os.path.abspath(os.curdir), + import_path=script_path).encode('utf8') - f.write(formatted_script) - f.close() + f.write(formatted_script) subprocess.Popen([sys.executable, injector_path, f.name, str(pid)], env=envs).wait() diff --git a/dllhook/mayhem b/dllhook/mayhem index a8d7efe..c5fca48 160000 --- a/dllhook/mayhem +++ b/dllhook/mayhem @@ -1 +1 @@ -Subproject commit a8d7efe074b8f09fafadfa86a36f0a0fe4632b6c +Subproject commit c5fca48dd9a4022e0a6fd9fca430d73811955ff5