https://github.com/starrfox/memobj
A library for defining objects in memory
https://github.com/starrfox/memobj
memory
Last synced: 8 months ago
JSON representation
A library for defining objects in memory
- Host: GitHub
- URL: https://github.com/starrfox/memobj
- Owner: StarrFox
- License: mit
- Created: 2022-02-19T18:19:49.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-02-03T18:02:31.000Z (over 1 year ago)
- Last Synced: 2025-02-03T19:22:33.120Z (over 1 year ago)
- Topics: memory
- Language: Python
- Homepage:
- Size: 237 KB
- Stars: 3
- Watchers: 4
- Forks: 1
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# memobj
A Python library for defining and reading structured objects directly from another process's memory.
## Installation
- Using pip:
- pip install memobj
- Using uv:
- uv add memobj
## Quickstart
```python
import os
from memobj import WindowsProcess, MemoryObject
from memobj.property import Signed4
class PythonIntObject(MemoryObject):
# note: this offset might be different in future python versions
value: int = Signed4(24)
process = WindowsProcess.from_id(os.getpid())
# id(x) gives the address of the object in cpython
my_int = PythonIntObject(address=id(1), process=process)
# prints 1
print(my_int.value)
```
See tests for more examples (pointer properties, process/module utilities, etc.).
## Development setup
This project uses uv as the build backend and package manager.
- Sync dependencies (including the tests group):
- uv sync --all-groups
- Run tests:
- uv run pytest
- Format code:
- isort . && black .
Optional: A Nix flake provides a dev shell with Python 3.11, just, black, isort, and more:
- nix develop
## Support
discord: