Skip to content

Commit 9c0864e

Browse files
committed
➕ Add Python
1 parent 036707f commit 9c0864e

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Python_Scripts/WriteProcessMemory.py

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from ctypes import *
2+
from ctypes.wintypes import *
3+
4+
PROCESS_ID = 9476 # From TaskManager for Notepad.exe
5+
PROCESS_HEADER_ADDR = 0x7ff7b81e0000 # From SysInternals VMMap utility
6+
7+
# write to address
8+
newValue = 50
9+
10+
PROCESS_VM_READ = 0x0010
11+
12+
k32 = WinDLL('kernel32')
13+
k32.OpenProcess.argtypes = DWORD,BOOL,DWORD
14+
k32.OpenProcess.restype = HANDLE
15+
k32.WriteProcessMemory.argtypes = HANDLE,LPVOID,LPVOID,c_size_t,POINTER(c_size_t)
16+
k32.WriteProcessMemory.restype = BOOL
17+
18+
process = k32.OpenProcess(PROCESS_VM_READ, 0, PROCESS_ID)
19+
s = c_size_t()
20+
21+
k32.WriteProcessMemory(process, PROCESS_HEADER_ADDR, newValue, 255, byref(s))

0 commit comments

Comments
 (0)