Skip to content

WibblyGhost/BitStructures

Repository files navigation

BitStructures

Intro

This package was inspired by many byte level decoders and structure packing that were made for python, many of them didn't really handle bit streams directly. Many packages I came across had a large list of outstanding issues and weren't updated in years. So I decided to make a package that does exactly this, making it easy to define structural patterns to define network payloads on the bit level.

Running in Python-3.12.xx and greater with new type support for the structures and classes that help classify the built and parsed data. Making it easy to see what data is getting processed, the size of the data and what we are trying to write. There are also methods to present the structure in a human readable form.

Issues/Discussions

Currently this is just a fun/personal project in my spare time so I may be unavailable to resolve or answer questions regarding this repo. But feel free to raise discussions/issues with me and I may be able to have a look.

If raising an issue please include the following:

  • The complete structure you are trying to build/parse.
  • Both the raw byte stream you tried to parse and the Container you tried to build.
  • What you expected to occur and any additional error output.

Development

This project uses Astral-UV as it's package manager, Astral-Ruff as code linting and formatting and MyPy for type checking. Start by cloning down this repo, the running a uv sync and pre-commit install.

Create a custom test.py file under the src/ directory to test out changes and custom codecs.

MR's

Feel free to give this repo a fork and apply modifications/customisation to it. Upon wanting changes modified in the main repo firstly raise a discussion with me on what you propose to change and we can continue from there.

Unit Tests

TODO:

About

Small library that helps define a decoding and encoding structure pattern that parses and builds bit streams.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages