Am inteles asa partial ce vrei. Uite un exemplu care functioneaza:
from ctypes import *
PROCESS_ALL_ACCESS = 0x1F0FFF
ADDRESS = 0x1000000 # Iau headerul de la .exe
PID = 3648 # In cazul meu e Process ID de la PyCharm
open_process = windll.kernel32.OpenProcess
read_process_memory = windll.kernel32.ReadProcessMemory
close_handle = windll.kernel32.CloseHandle
buff = c_char_p('aici ceva string pointer')
buff_size = len(buff.value)
bytes_read = c_ulong(0)
process_handle = open_process(PROCESS_ALL_ACCESS, False, PID)
if read_process_memory(process_handle, ADDRESS, buff, buff_size, byref(bytes_read)):
print("Success: {}".format(buff))
else:
print("Failed.")
close_handle(process_handle)
BTW, `address = address + 0x14` nu cred ca face ceea ce te astepti tu sa faca
Uite, un exemplu de pointer catre un chunk de memorie:
>>> import ctypes
>>> x = (ctypes.c_ulong*5)()
>>> x
<__main__.c_ulong_Array_5 object at 0x00C2DB20>
>>> ctypes.cast(x, ctypes.POINTER(ctypes.c_ulong))
<__main__.LP_c_ulong object at 0x0119FD00>
>>>
Ai un exemplu pe git cu mai multe functionalitati:
https://github.com/thezdi/scripts/blob/master/python_injector.py
Sper sa te ajute.