Answer the question
In order to leave comments, you need to log in
Is it possible to write a script in Python that changes data in the RAM of a specific running application?
Actually a question in a subject.
How and with what library, in Python, to write a script that changes data in the RAM of a specific running application?
You need to find and change specific data. For example, a year.
Now I do it with my hands in HDX. But I want to automate the process,
Google did not help (
Answer the question
In order to leave comments, you need to log in
With ctypes :
import sys
import ctypes
import ctypes.wintypes as wintypes
PROCESS_ALL_ACCESS = 0x1F0FFF
kernel32 = ctypes.windll.kernel32
kernel32.OpenProcess.restype = wintypes.HANDLE
kernel32.OpenProcess.argtypes = [
wintypes.DWORD,
wintypes.BOOL,
wintypes.DWORD
]
kernel32.CloseHandle.restype = wintypes.BOOL
kernel32.CloseHandle.argtypes = [ wintypes.HANDLE ]
kernel32.WriteProcessMemory.restype = wintypes.BOOL
kernel32.WriteProcessMemory.argtypes = [
wintypes.HANDLE,
wintypes.LPVOID,
wintypes.LPCVOID,
ctypes.c_size_t,
ctypes.POINTER(ctypes.c_size_t)
]
pid = int(sys.argv[1])
addr = int(sys.argv[2], 16)
val = 42
buf = (val).to_bytes(4, byteorder='little')
buf_ptr = ctypes.c_char_p(buf)
ph = kernel32.OpenProcess(PROCESS_ALL_ACCESS, False, pid)
kernel32.WriteProcessMemory(ph, addr, buf_ptr, len(buf), None)
kernel32.CloseHandle(ph)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question