I am encountering an error while using the inject_python_shellcode function from the pymem package. The error message indicates that the memory allocation for the shellcode failed.
arduino
复制代码
Traceback (most recent call last):
File "C:\Users\test.py", line 46, in
print(test_inject_python_shellcode())
File "C:\Users\test.py", line 38, in test_inject_python_shellcode
pm.inject_python_shellcode(shellcode)
File "C:\Users\yangzdu.conda\envs\VTMP\lib\site-packages\pymem__init__.py", line 175, in inject_python_shellcode
raise RuntimeError('Could not allocate memory for shellcode')
RuntimeError: Could not allocate memory for shellcode
Code to Reproduce:
Create a new Python file with the code above.
Replace 'some_process.exe' with the actual process you are targeting.
Replace b'...' with the actual shellcode.
Run the script.
Expected Behavior:
The shellcode should be injected without any errors.
Actual Behavior:
The script raises a RuntimeError indicating that it could not allocate memory for the shellcode.
Additional Context:
I have tried different processes and shellcodes, but the error persists. Any help or suggestions would be greatly appreciated.
Description:
I am encountering an error while using the inject_python_shellcode function from the pymem package. The error message indicates that the memory allocation for the shellcode failed.
Environment:
Python version: 3.7.16 pymem version: 1.3 Operating System: Windows Error Traceback:
arduino 复制代码 Traceback (most recent call last): File "C:\Users\test.py", line 46, in
print(test_inject_python_shellcode())
File "C:\Users\test.py", line 38, in test_inject_python_shellcode
pm.inject_python_shellcode(shellcode)
File "C:\Users\yangzdu.conda\envs\VTMP\lib\site-packages\pymem__init__.py", line 175, in inject_python_shellcode
raise RuntimeError('Could not allocate memory for shellcode')
RuntimeError: Could not allocate memory for shellcode
Code to Reproduce:
python 复制代码 import pymem
def test_inject_python_shellcode(): notepad = subprocess.Popen(['notepad.exe'])
f = open("{}", "w+") f.write("2131313") f.close() """.format(filepath) pm.inject_python_shellcode(shellcode)
Create a new Python file with the code above. Replace 'some_process.exe' with the actual process you are targeting. Replace b'...' with the actual shellcode. Run the script. Expected Behavior: The shellcode should be injected without any errors.
Actual Behavior: The script raises a RuntimeError indicating that it could not allocate memory for the shellcode.
Additional Context: I have tried different processes and shellcodes, but the error persists. Any help or suggestions would be greatly appreciated.