Skip to main content

High-performance Windows Memory Scanner/Editor

Project description

MemEdit

MemEdit is a high-performance Python library for Windows memory manipulation, built with a C++20 core and pybind11. It is designed for speed, efficiency, and ease of use, making it ideal for memory scanning and editing tasks.

Features

  • C++20 Core: Leverages modern C++ features for maximum performance.
  • Multi-threaded Scanning: Uses std::async and parallel processing to scan large memory blocks (GBs) in seconds.
  • SIMD-Ready: Designed for efficient buffer comparisons.
  • AOB Scanning: Supports "Array of Bytes" searching with wildcards (e.g., 48 8B ?? 05 ?? ?? ?? ??).
  • Pythonic Interface: Clean and easy-to-use Python bindings.
  • GIL Management: Releases the Global Interpreter Lock (GIL) during heavy scanning operations to prevent UI freezing.
  • RAII Memory Management: Safely handles process handles using modern C++ practices.

Requirements

  • Windows OS
  • Python 3.7+
  • C++20 compatible compiler (MSVC recommended)
  • pybind11

Installation

To compile and install MemEdit, run the following command in the project root:

pip install .

Or for development:

python setup.py build_ext --inplace

Usage

Basic Scanning

import MemEdit

# Attach to a process by PID
pid = 1234
scanner = MemEdit.Scanner(pid)

if scanner.is_valid():
    # Perform a first scan for an int32 value
    results = scanner.first_scan_int32(100)
    print(f"Found {len(results)} addresses.")

    # Filter results with a next scan
    results = scanner.next_scan_int32(200)
    print(f"Filtered to {len(results)} addresses.")

    # Write to memory
    if results:
        scanner.write_int32(results[0], 9999)

AOB Scanning

# Scan for a pattern with wildcards
pattern = "48 8B ?? 05 ?? ?? ?? ??"
results = scanner.aob_scan(pattern)
for addr in results:
    print(f"Pattern found at: {hex(addr)}")

Performance Optimization

MemEdit optimizes performance by:

  1. Filtering Regions: Only scans MEM_COMMIT and readable/writable regions (PAGE_READWRITE, etc.) using VirtualQueryEx.
  2. Parallel Execution: Distributes scanning tasks across multiple threads.
  3. Efficient I/O: Minimizes ReadProcessMemory calls by reading large chunks into buffers.

Error Handling

The library includes robust error handling for common issues:

  • Access Denied: Returns an invalid scanner object if the process cannot be opened.
  • Read/Write Failures: Throws Python exceptions or returns boolean status for memory operations.

License

MIT License

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

memedit_g3tfun-0.1.2.tar.gz (5.0 kB view details)

Uploaded Source

File details

Details for the file memedit_g3tfun-0.1.2.tar.gz.

File metadata

  • Download URL: memedit_g3tfun-0.1.2.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0rc1

File hashes

Hashes for memedit_g3tfun-0.1.2.tar.gz
Algorithm Hash digest
SHA256 8917c5fbfb2736c5b607c366223bbba7ef338a5548533a245fdb59fbc020f44c
MD5 8bd392fc3d733e7daa76e3b5724f01ff
BLAKE2b-256 58436c7226fed7baad89822428ca335bbf8b8c0db6e718528e61d521bb1c0299

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page