PyMemRW


NamePyMemRW JSON
Version 0.0.0.1 PyPI version JSON
download
home_pagehttps://github.com/Mahdi-hasan-shuvo/PyMemoryRW
SummaryA library for manipulating memory in a Windows process
upload_time2024-09-01 18:04:25
maintainerNone
docs_urlNone
authorMahdi Hasan Shuvo
requires_python>=3.11
licenseMIT
keywords memory manipulation windows memory management process memory windows api memory injection memory editing windows process memory library process hacking windows utilities memory access system programming memory tools win32 api python memory library process manipulation memory read/write windows programming memory management library python windows api
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            

#### This library provides a set of functions for manipulating memory in a Windows process. It allows you to read and write memory, inject DLLs, and search for byte patterns in memory.

[![Twine Version](https://img.shields.io/pypi/v/twine.svg)](https://pypi.org/project/twine)
[![Python Versions](https://img.shields.io/pypi/pyversions/twine.svg)](https://pypi.org/project/twine)
[![Docs Badge](https://img.shields.io/readthedocs/twine)](https://twine.readthedocs.io)
[![Build Status](https://img.shields.io/github/actions/workflow/status/pypa/twine/main.yml?branch=main)](https://github.com/pypa/twine/actions)







## installation
<pre><code>pip install PyMemoryR-W</code></pre> 
## Functions

### `process_handle(app_name)`

Returns a process handle for the given App name.

**Usage:**
```python
from PyMemoryRW import process_handle

# Get a handle for the Notepad process
handle = process_handle("notepad.exe")
print(handle)  # Output might look like: <Handle pid='1234'>
```
### `inject_dll(process_handle, dll_path)`

Injects a DLL into a running process.

**Usage:**
```
from PyMemoryRW import process_handle, inject_dll

# Get a handle for the target process
handle = process_handle("myapp.exe")

# Path to the DLL to inject
dll_path = "C:\\Path\\To\\MyDLL.dll"

# Inject the DLL into the target process
inject_dll(handle, dll_path)
```

### `write_memory(process_handle, base_address, data) `
Writes data to a chunk of memory in the process.

**Usage:**
```python
from PyMemoryRW import process_handle, write_memory

# Get a handle for the target process
handle = process_handle("myapp.exe")

# Memory address to write to
base_address = 0x1000000

# Data to write (must be bytes)
data = b'Hello, World!'

# Write the data to the process memory
write_memory(handle, base_address, data)
```


### `read_memory(process_handle, base_address, size)`
Reads a valu of memory from the process.

**Usage:**
```python

from PyMemoryRW import process_handle, read_memory


# Open the process (replace with your process ID)
process_handle = process_handle("notepad.exe")

# Memory address to read from
base_address = 0x10000000

# Number of bytes to read
size = 1024

# Read the memory contents
data = read_memory(process_handle, base_address, size)

# Print the contents of the memory region
print(data)

```
### `search_byte_pattern(process_handle, pattern) `
Searches for a byte pattern in the process memory and returns a list of dictionaries containing the addresses where the pattern was found, along with the original data at those addresses.

**Usage:**
```python
from PyMemoryRW import process_handle, search_byte_pattern

# Get a handle for the target process
handle = process_handle("xyz.exe")

# Byte arrry pattern to search for
byte_pattern = bytes.fromhex('A0 42 00 00 C0 3F 33 33 13 40 00 00 F0 3F 00')
# Byte pattern to search for
value=12413414
pattern = value.to_bytes(4, byteorder='little')

# Search for the byte pattern in the process memory
matches = search_byte_pattern(handle, pattern)

# Print the results
print(matches)  # Example output: [{'address': '0x1000000', 'data': '12345678'}, {'address': '0x2000000', 'data': '12345678'}]
```


### `Scan_pattern(process_handle, pattern) `
The Scan_pattern function searches for a given byte pattern in the memory of a specified process. The pattern can include specific bytes and wildcards (??) that match any byte.

**Usage:**
```python
from PyMemoryRW import Scan_pattern

# Get a handle for the target process (example handle value)
handle = process_handle("xyz.exe")

# Byte pattern to search for, with '??' as wildcards
patterns = "12 34 ?? 56 ?? 11"

# Search for the byte pattern in the process memory
matches = Scan_pattern(process_handle, patterns)

# Print the results
print(matches)  # Example output: [{'base_address': '0x1000', 'data': '12 34 78 56 88 11'}, {'base_address': '0x2000', 'data': '12 34 90 56 33 11'}]

```


### Requirements
<h3>Requirements</h3> <p>To use this library, you need the following Python libraries:</p> <ul> <li>pymem</li> <li>pyinjector</li> <li>ctypes (included in the standard library)</li> </ul> <p>You can install the required libraries using pip:</p> <pre><code>pip install pymem pyinjector mahdix</code></pre> 
<h3>Author</h3>
<p>Mahdi Hasan Shuvo</p>
<h3>Contact</h3>
<ul>
  <li>Email: <a href="mailto:shuvobbhh@gmail.com">shuvobbhh@gmail.com</a></li>
  <li>WhatsApp: <a href="https://wa.me/+8801616397082">+8801616397082</a></li>
  <li>GitHub: <a href="https://github.com/Mahdi-hasan-shuvo">Mahdi-hasan-shuvo</a></li>
  <li>Facebook: <a href="https://www.facebook.com/ma4D1">Mahdi Hasan Shuvo</a></li>
</ul>

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Mahdi-hasan-shuvo/PyMemoryRW",
    "name": "PyMemRW",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "memory manipulation Windows memory management process memory Windows API memory injection memory editing Windows process memory library process hacking Windows utilities memory access system programming memory tools Win32 API Python memory library process manipulation memory read/write Windows programming memory management library Python Windows API",
    "author": "Mahdi Hasan Shuvo",
    "author_email": "shuvobbhh@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/58/56/74a499001a5333a3ae7031233c3921175f191a1f9428154db977b95c77f6/pymemrw-0.0.0.1.tar.gz",
    "platform": null,
    "description": "\n\n#### This library provides a set of functions for manipulating memory in a Windows process. It allows you to read and write memory, inject DLLs, and search for byte patterns in memory.\n\n[![Twine Version](https://img.shields.io/pypi/v/twine.svg)](https://pypi.org/project/twine)\n[![Python Versions](https://img.shields.io/pypi/pyversions/twine.svg)](https://pypi.org/project/twine)\n[![Docs Badge](https://img.shields.io/readthedocs/twine)](https://twine.readthedocs.io)\n[![Build Status](https://img.shields.io/github/actions/workflow/status/pypa/twine/main.yml?branch=main)](https://github.com/pypa/twine/actions)\n\n\n\n\n\n\n\n## installation\n<pre><code>pip install PyMemoryR-W</code></pre> \n## Functions\n\n### `process_handle(app_name)`\n\nReturns a process handle for the given App name.\n\n**Usage:**\n```python\nfrom PyMemoryRW import process_handle\n\n# Get a handle for the Notepad process\nhandle = process_handle(\"notepad.exe\")\nprint(handle)  # Output might look like: <Handle pid='1234'>\n```\n### `inject_dll(process_handle, dll_path)`\n\nInjects a DLL into a running process.\n\n**Usage:**\n```\nfrom PyMemoryRW import process_handle, inject_dll\n\n# Get a handle for the target process\nhandle = process_handle(\"myapp.exe\")\n\n# Path to the DLL to inject\ndll_path = \"C:\\\\Path\\\\To\\\\MyDLL.dll\"\n\n# Inject the DLL into the target process\ninject_dll(handle, dll_path)\n```\n\n### `write_memory(process_handle, base_address, data) `\nWrites data to a chunk of memory in the process.\n\n**Usage:**\n```python\nfrom PyMemoryRW import process_handle, write_memory\n\n# Get a handle for the target process\nhandle = process_handle(\"myapp.exe\")\n\n# Memory address to write to\nbase_address = 0x1000000\n\n# Data to write (must be bytes)\ndata = b'Hello, World!'\n\n# Write the data to the process memory\nwrite_memory(handle, base_address, data)\n```\n\n\n### `read_memory(process_handle, base_address, size)`\nReads a valu of memory from the process.\n\n**Usage:**\n```python\n\nfrom PyMemoryRW import process_handle, read_memory\n\n\n# Open the process (replace with your process ID)\nprocess_handle = process_handle(\"notepad.exe\")\n\n# Memory address to read from\nbase_address = 0x10000000\n\n# Number of bytes to read\nsize = 1024\n\n# Read the memory contents\ndata = read_memory(process_handle, base_address, size)\n\n# Print the contents of the memory region\nprint(data)\n\n```\n### `search_byte_pattern(process_handle, pattern) `\nSearches for a byte pattern in the process memory and returns a list of dictionaries containing the addresses where the pattern was found, along with the original data at those addresses.\n\n**Usage:**\n```python\nfrom PyMemoryRW import process_handle, search_byte_pattern\n\n# Get a handle for the target process\nhandle = process_handle(\"xyz.exe\")\n\n# Byte arrry pattern to search for\nbyte_pattern = bytes.fromhex('A0 42 00 00 C0 3F 33 33 13 40 00 00 F0 3F 00')\n# Byte pattern to search for\nvalue=12413414\npattern = value.to_bytes(4, byteorder='little')\n\n# Search for the byte pattern in the process memory\nmatches = search_byte_pattern(handle, pattern)\n\n# Print the results\nprint(matches)  # Example output: [{'address': '0x1000000', 'data': '12345678'}, {'address': '0x2000000', 'data': '12345678'}]\n```\n\n\n### `Scan_pattern(process_handle, pattern) `\nThe Scan_pattern function searches for a given byte pattern in the memory of a specified process. The pattern can include specific bytes and wildcards (??) that match any byte.\n\n**Usage:**\n```python\nfrom PyMemoryRW import Scan_pattern\n\n# Get a handle for the target process (example handle value)\nhandle = process_handle(\"xyz.exe\")\n\n# Byte pattern to search for, with '??' as wildcards\npatterns = \"12 34 ?? 56 ?? 11\"\n\n# Search for the byte pattern in the process memory\nmatches = Scan_pattern(process_handle, patterns)\n\n# Print the results\nprint(matches)  # Example output: [{'base_address': '0x1000', 'data': '12 34 78 56 88 11'}, {'base_address': '0x2000', 'data': '12 34 90 56 33 11'}]\n\n```\n\n\n### Requirements\n<h3>Requirements</h3> <p>To use this library, you need the following Python libraries:</p> <ul> <li>pymem</li> <li>pyinjector</li> <li>ctypes (included in the standard library)</li> </ul> <p>You can install the required libraries using pip:</p> <pre><code>pip install pymem pyinjector mahdix</code></pre> \n<h3>Author</h3>\n<p>Mahdi Hasan Shuvo</p>\n<h3>Contact</h3>\n<ul>\n  <li>Email: <a href=\"mailto:shuvobbhh@gmail.com\">shuvobbhh@gmail.com</a></li>\n  <li>WhatsApp: <a href=\"https://wa.me/+8801616397082\">+8801616397082</a></li>\n  <li>GitHub: <a href=\"https://github.com/Mahdi-hasan-shuvo\">Mahdi-hasan-shuvo</a></li>\n  <li>Facebook: <a href=\"https://www.facebook.com/ma4D1\">Mahdi Hasan Shuvo</a></li>\n</ul>\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A library for manipulating memory in a Windows process",
    "version": "0.0.0.1",
    "project_urls": {
        "Bug Reports": "https://github.com/Mahdi-hasan-shuvo/PyMemoryRW/issues",
        "Homepage": "https://github.com/Mahdi-hasan-shuvo/PyMemoryRW",
        "Source": "https://github.com/Mahdi-hasan-shuvo/PyMemoryRW"
    },
    "split_keywords": [
        "memory",
        "manipulation",
        "windows",
        "memory",
        "management",
        "process",
        "memory",
        "windows",
        "api",
        "memory",
        "injection",
        "memory",
        "editing",
        "windows",
        "process",
        "memory",
        "library",
        "process",
        "hacking",
        "windows",
        "utilities",
        "memory",
        "access",
        "system",
        "programming",
        "memory",
        "tools",
        "win32",
        "api",
        "python",
        "memory",
        "library",
        "process",
        "manipulation",
        "memory",
        "read/write",
        "windows",
        "programming",
        "memory",
        "management",
        "library",
        "python",
        "windows",
        "api"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3af514031e80eda818d5c018f3f936b5bf147d78b2cbee10e79706db1a00edec",
                "md5": "c29daa71c6dae0da2569f0367ccaed60",
                "sha256": "56b41158de7946d76d3adfe4e5d3454fa125bf7b8fe4457b8b3a9875eb859dd2"
            },
            "downloads": -1,
            "filename": "PyMemRW-0.0.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c29daa71c6dae0da2569f0367ccaed60",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 6882,
            "upload_time": "2024-09-01T18:04:23",
            "upload_time_iso_8601": "2024-09-01T18:04:23.648311Z",
            "url": "https://files.pythonhosted.org/packages/3a/f5/14031e80eda818d5c018f3f936b5bf147d78b2cbee10e79706db1a00edec/PyMemRW-0.0.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "585674a499001a5333a3ae7031233c3921175f191a1f9428154db977b95c77f6",
                "md5": "0f748371545168a583a1edf5703234be",
                "sha256": "edde64f0cd8afef3880144de91a14167ab98baca2b09285b727230a39087edf9"
            },
            "downloads": -1,
            "filename": "pymemrw-0.0.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "0f748371545168a583a1edf5703234be",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 6449,
            "upload_time": "2024-09-01T18:04:25",
            "upload_time_iso_8601": "2024-09-01T18:04:25.452541Z",
            "url": "https://files.pythonhosted.org/packages/58/56/74a499001a5333a3ae7031233c3921175f191a1f9428154db977b95c77f6/pymemrw-0.0.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-01 18:04:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Mahdi-hasan-shuvo",
    "github_project": "PyMemoryRW",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pymemrw"
}
        
Elapsed time: 0.33817s