Windows memory manipulation toolkit for Python
Project description
PyWinMem
Windows memory manipulation toolkit for Python.
Features
- Enumerate processes/threads/modules
- Read/write process memory
- Pattern scanning
- Memory protection management
Installation
pip install pywinmem
Basic usage
# Sample usage of pywinmem library
from pywinmem import Process, ProcessAccess, MemoryAccess
# Example process name and access rights
process_name = "example_process.exe" # Replace with the actual process name
access_rights = ProcessAccess.ALL_ACCESS
# Using context manager to attach to the process
with Process(process_name, access_rights) as process:
print(f"Attached to process: {process_name} with PID: {process.process_id}")
# Read memory from the process
address = 0x1000 # Replace with the actual memory address to read from
size = 4 # Number of bytes to read
value, bytes_read = process.read_memory(address, size)
print(f"Read {bytes_read} bytes from address {hex(address)}: {value}")
# Write memory to the process
new_value = b'\xef\xbe\xad\xde' # Replace with the data to write
bytes_written = process.write_memory(address, new_value, len(new_value))
print(f"Wrote {bytes_written} bytes to address {hex(address)}: {new_value}")
# Get memory protection information
mem_info = process.get_memory_info(address)
print(f"Memory protection info at address {hex(address)}: {mem_info}")
# Change memory protection
old_protect = process.protect_memory(address, size, MemoryAccess.PAGE_READWRITE)
print(f"Changed memory protection at address {hex(address)} to PAGE_READWRITE, old protection: {old_protect}")
# The process will automatically detach when exiting the context manager
print(f"Detached from process: {process_name}")
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pywinmem-1.1.0.tar.gz
(107.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
pywinmem-1.1.0-py3-none-any.whl
(109.9 kB
view details)
File details
Details for the file pywinmem-1.1.0.tar.gz.
File metadata
- Download URL: pywinmem-1.1.0.tar.gz
- Upload date:
- Size: 107.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f25624dfa793c97882aa186e6e2af34bd5fd765e6682ae09e1c3d7c7e780cab8
|
|
| MD5 |
f1c9c02f876bd20d29ebf3a39fd8abf6
|
|
| BLAKE2b-256 |
8605cba2a40b48de7bd13cee31e71482a7c581f309e31497b39e3d3eaff60dd8
|
File details
Details for the file pywinmem-1.1.0-py3-none-any.whl.
File metadata
- Download URL: pywinmem-1.1.0-py3-none-any.whl
- Upload date:
- Size: 109.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7e26fd4c2a84ccf33a93ff7c0255c48bae8eb4c5f0e7ea5d2fffeab0a364296
|
|
| MD5 |
9ca7b09494a1b107af3ee894505b79e2
|
|
| BLAKE2b-256 |
3c3b86260049743dfaee288507f32c8820c773051a2dc29563e18e7dc5f9574a
|