pybinary
A simple binary serializer/deserializer in pure python.
Limitations
Variable-sized fields are not supported. No size check on assignment for the most of the types.
Installation
Install from pypi:
pip install pybinary
Or download the repository and build from the sources:
python3 ./setup.py build
python3 ./setup.py install
Examples
ELF64 header
Spec taken from https://refspecs.linuxfoundation.org/elf/gabi4+/ch4.eheader.html
class Elf64_Ehdr(BinarySerializable):
e_ident = ArrayTypes.bytearray(16)
e_type = Types.u16
e_machine = Types.u16
e_version = Types.u32
e_entry = Types.u64
e_phoff = Types.u64
e_shoff = Types.u64
e_flags = Types.u32
e_ehsize = Types.u16
e_phentsize = Types.u16
e_phnum = Types.u16
e_shentsize = Types.u16
e_shnum = Types.u16
e_shstrndx = Types.u16
header = Elf64_Ehdr.deserialize(input_stream_or_bytes) # deserialize header
header.e_phnum += 1 # update any field
header.serialize() # serialize and get updated bytes
...
CPIO Newc ACII Format Archive
Spec taken from https://manpages.ubuntu.com/manpages/bionic/man5/cpio.5.html
Metadata
Release files for pybinary 0.9.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pybinary-0.9.6.tar.gz | 5.4 kB | Without provenance | Details for pybinary-0.9.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pybinary-0.9.6-py3-none-any.whl | Python 3 | none | any | Details for pybinary-0.9.6-py3-none-any.whl |
Total release size: 10.9 kB
Release files / pybinary-0.9.6.tar.gz
| Download URL | pybinary-0.9.6.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b932be9afa7bdf91b62e2af21c058252a9fccab63d955ccbae4c6d69dfc01e92
|
|
BLAKE2b-256 checksum How to use checksums |
9c650153fb674a9246bee395ea5c0e579e4f1f6edf18becef9e4eb8a8030d51a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.22
|
Release files / pybinary-0.9.6-py3-none-any.whl
| Download URL | pybinary-0.9.6-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
096393651dacbe8adbab32592522ccec98d07428a2e0676951760e1d0d7b7f6e
|
|
BLAKE2b-256 checksum How to use checksums |
735c831810546d8797c38c780121dfdc13c70b65be3f6eee37acc663ce69a9b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.22
|
Security for pybinary 0.9.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.