Memhax
A python library for accessing raw python objects and other regions in memory.
Installation
$ pip install memhax
Usage
Read/Write raw memory
from memhax.constants import memory
# Read 4 bytes from address 0x12345678
with memory(0x12345678) as mem:
data = mem.read(4)
Dump an object's struct
from memhax.cpython.primitives import PyLongObject
print(PyLongObject)
# struct PyLongObject {
# Py_ssize_t ob_refcnt;
# PyTypeObject* ob_type;
# Py_ssize_t ob_size;
# uint32_t[] ob_digit;
# }
Read/modify python objects
from memhax.cpython.collections import PyTupleObject
my_tuple = (1, "abc", 3.5)
tuple_obj = PyTupleObject(id(my_tuple))
# Get the tuple's length
print(tuple_obj.ob_size()) # => 3
# Replace an item in the tuple
new_item = [my_tuple, b"123"]
tuple_obj.ob_item[0].raw(id(new_item))
print(my_tuple) # => ([(...), b'123'], 'abc', 3.5)
Metadata
Release files for memhax 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| memhax-0.1.0.tar.gz | 9.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| memhax-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.8 kB
Release files / memhax-0.1.0.tar.gz
| Download URL | memhax-0.1.0.tar.gz |
|---|---|
| Size | 9.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d617beccb6c8d452cd0c53c6547b99bcd23ea59efc4736010b5016bcf9a672d5
|
|
BLAKE2b-256 checksum How to use checksums |
9df3aeac8e339cb75fb0d03a8bd5734d1f9d21e3f5ff5b3c9778e3b0a7ba362a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.0rc1
|
Release files / memhax-0.1.0-py3-none-any.whl
| Download URL | memhax-0.1.0-py3-none-any.whl |
|---|---|
| Size | 12.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
55373eddbec32a4e8f197ccad947e6ed6b9554452f5909fa5513ff8d55f496e6
|
|
BLAKE2b-256 checksum How to use checksums |
9a756c4bd8bfb4f7be58a850e6f201ffb405ed103f8e89b5691ff5e917fc3d66
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.0rc1
|