Skip to main content

Generate RFC-style ASCII packet diagrams from field definitions

Project description

pktfmt

Generate RFC-style ASCII packet diagrams from field definitions.

Installation

pip install pktfmt

Usage

Inline format

pktfmt "Type:16,Length:16,Payload:*"

Output:

 0                  1                  2                  3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|              Type             |             Length            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
:                            Payload                            :
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

JSON file

pktfmt packet.json
{
  "name": "MyPacket",
  "fields": [
    {"name": "Type", "bits": 16},
    {"name": "Length", "bits": 16},
    {"name": "Payload", "bits": "*"}
  ]
}

Options

pktfmt "Type:16,Data:32" --bits-per-row 16   # Custom row width
pktfmt "Type:32" --no-ruler                   # Omit bit number header

Field syntax

  • Name:N - Fixed-width field of N bits
  • Name:* - Variable-length field (rendered with : borders)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pktfmt-0.1.0.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pktfmt-0.1.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file pktfmt-0.1.0.tar.gz.

File metadata

  • Download URL: pktfmt-0.1.0.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pktfmt-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5c551694e82681793a93e482a141e2d854a7fafd2ce669253ec7e847b40c2fd9
MD5 afec79665de5f1960c8f9b2272d4a6c7
BLAKE2b-256 307119bf36dfe2fc1d4235878504d2680941255ae70c596b8bf1bcb99c41e7a2

See more details on using hashes here.

File details

Details for the file pktfmt-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pktfmt-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pktfmt-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fa2e59f696effa40d7c1546aa83a9d436f4a4568410f54ce3d1dcb078cd4faf4
MD5 a7765869e122e21d4aaea7e74c6d1aca
BLAKE2b-256 d719880b9675c2af0aa46a400cc886e6f7a5430c29205b1018e23fcd9871fc8e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page