(process, code)
| 386 | |
| 387 | |
| 388 | def execute_python_code(process, code): |
| 389 | # Cache the value ? |
| 390 | py_dll_name = get_dll_name_from_python_version() |
| 391 | pydll_path = find_python_dll_to_inject(process.bitness) |
| 392 | if sys.version_info.major == 3: |
| 393 | # FOr py3, we may have a per-user install. |
| 394 | # Meaning that the vcruntime140.dll will not be in the injected process path |
| 395 | # Find it & load-it as well, it should be in the same directory as pythonxx.dll |
| 396 | vc_runtime_dll = os.path.join(os.path.dirname(pydll_path), "vcruntime140.dll") |
| 397 | load_dll_in_remote_process(process, vc_runtime_dll) |
| 398 | # Try to inject the vcrunt |
| 399 | load_dll_in_remote_process(process, pydll_path) |
| 400 | shellcode, pythoncode = inject_python_command(process, code, py_dll_name) |
| 401 | t = process.create_thread(shellcode, pythoncode) |
| 402 | return t |
| 403 | |
| 404 | |
| 405 | retrieve_exc = r""" |
no test coverage detected