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.1.tar.gz (3.5 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: memedit_g3tfun-0.1.1.tar.gz
  • Upload date:
  • Size: 3.5 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.1.tar.gz
Algorithm Hash digest
SHA256 393f696a7c702019b55465ab7266550b785008ee3071dd4f59e623133b14ef11
MD5 b59bb10e2d97ff410b4e0c2a2bfe22ba
BLAKE2b-256 4ca67a7bd9902b3f991c674968e5c71ad508e474163bd620468b92a746d361e8

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