Building a Windows memory scanner in Python with ctypes and NumPy
Unfair is a Windows memory scanner in one Python file. The hard parts were not the Win32 calls: they were narrowing 5,827 candidates to one, guarding a tool that can write to any process, and shipping it as an elevated exe.
In short
- One scan proves little: searching for 100 returns thousands of addresses, and two or three rescans after the value changes usually leave a handful.
- Only committed, unguarded, writable private or image regions are read, which shrinks the work a lot compared with the whole address space.
- Unknown-value scans snapshot every eligible region and filter with NumPy, at the cost of up to hundreds of MB, then fall back to a cheap address list under two million survivors.
#python#ctypes#windows#numpy