A Python library for generating x86 machine code.
Project description
pytocpu
pytocpu is a Python library for generating machine code programmatically.
Current status: Alpha (0.1.0)
Features
- Generate x86 machine code
- Save output as binary (
.bin) files - Get machine code as bytes
- Get machine code as hexadecimal text
- Lightweight and easy to use
Installation
pip install pytocpu
Example
from pytocpu import X86
asm = X86()
asm.mov("eax", 123)
asm.nop()
asm.ret()
print(asm.hex())
asm.save("program.bin")
Output:
B8 7B 00 00 00 90 C3
Supported Instructions
movnopret
More instructions will be added in future releases.
Roadmap
Version 0.2.0
- x64 support
Future
- ARM64 support
- RISC-V support
- More x86 instructions
- Labels and jumps
- Executable generation utilities
License
MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pytocpu-0.1.0.tar.gz
(3.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pytocpu-0.1.0.tar.gz.
File metadata
- Download URL: pytocpu-0.1.0.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6f1be78ba6d64280230c163d43504dc1363a32c4785aca61e3a12e3a1bb0c04
|
|
| MD5 |
f0be6e5c84dd40535341545bbe4d00c8
|
|
| BLAKE2b-256 |
2e7f4a8572e7a6aa340b7f14441139933501e28f136acd94273a3d3b455a8a86
|
File details
Details for the file pytocpu-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pytocpu-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
23122c9d6ad8fd22ae09ad04a748b18fce12902519a75c8b72e87a502827aa0a
|
|
| MD5 |
2e1b3f5464e2880d63a18aa2fdc948fd
|
|
| BLAKE2b-256 |
f5174be783d486d1ac5c6969732ce63607a7beea480defd370c6123eea3e4c4f
|