packetdiagram


Namepacketdiagram JSON
Version 0.0.1 PyPI version JSON
download
home_pageNone
SummaryA tool to generate packet diagrams and save them as png or svg.
upload_time2025-09-05 17:17:03
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseNone
keywords diagram packet visualization
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            **PacketDiagram** is a simple and intuitive Python library for creating packet diagrams. These diagrams allow you to visualize the structure of data packet fields, including nested subfields, and export them in **SVG** or **PNG** format.

---

## 📌 Features

- **Packet Diagram Creation**: Visualize the hierarchical structure of packets and their fields.
- **Customizable Colors**: Modify the colors of outlines, text, and parent lines.
- **Flexible Export**: Save your diagrams as **SVG** or **PNG**.
- **Intuitive API**: A simple and well-documented interface for quick adoption.

## 📦 Installation

Install **PacketDiagram** via pip :

```bash
pip install packetdiagram
```

## 🚀 Getting started

Here is a minimal example to create a basic diagram and to export it as a `.png` file

```python
import packetdiagram

# Create a new diagram
my_diagram = packetdiagram.Diagram()

# Add a packet to the diagram
packet = my_diagram.add_new_packet("Ethernet Frame")

# Add fields to the packet
packet.add_field("Destination MAC", 7)
packet.add_field("Source MAC", 7)
packet.add_field("Ether-Field", 5)
parent_field = packet.add_field("Packet", 10)
packet.add_field("FCS", 2)

# Add another packet to the diagram
packet = my_diagram.add_new_packet("Ethernet Frame")

# Set packet parent field
packet.set_parent(parent_field)

# Add fields to the second packet
packet.add_field("Source IP", 6)
packet.add_field("Destination IP", 6)
packet.add_field("Protocol", 6)
packet.add_field("...", 4)
packet.add_field("Segment", 6)

# Draw the diagram and saves it
my_diagram.draw_to_file("ethernet_frame.png")
```

**Result :**

![Basic diagram example](https://raw.githubusercontent.com/JoramFC/packetdiagram/main/docs/images/ethernet_frame.png "Basic diagram - Ethernet frame")

## 🤝 Contributing

Contributions are welcome! Here's how you can contribute:

1. Report a Bug: Open an issue on GitHub.
2. Suggest an Improvement: Open a pull request.
3. Improve Documentation: Any help to improve this README or add examples is appreciated.

## 📄 License

This project is licensed under the MIT License. See the LICENSE file for more details.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "packetdiagram",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "diagram, packet, visualization",
    "author": null,
    "author_email": "Joram Fillol-Carlini <joram.fillolcarlini@laposte.net>",
    "download_url": "https://files.pythonhosted.org/packages/e6/33/c580800cb133afed9206abb90d7a104fb628758c752c181b24c73bcf45ca/packetdiagram-0.0.1.tar.gz",
    "platform": null,
    "description": "**PacketDiagram** is a simple and intuitive Python library for creating packet diagrams. These diagrams allow you to visualize the structure of data packet fields, including nested subfields, and export them in **SVG** or **PNG** format.\r\n\r\n---\r\n\r\n## \ud83d\udccc Features\r\n\r\n- **Packet Diagram Creation**: Visualize the hierarchical structure of packets and their fields.\r\n- **Customizable Colors**: Modify the colors of outlines, text, and parent lines.\r\n- **Flexible Export**: Save your diagrams as **SVG** or **PNG**.\r\n- **Intuitive API**: A simple and well-documented interface for quick adoption.\r\n\r\n## \ud83d\udce6 Installation\r\n\r\nInstall **PacketDiagram** via pip :\r\n\r\n```bash\r\npip install packetdiagram\r\n```\r\n\r\n## \ud83d\ude80 Getting started\r\n\r\nHere is a minimal example to create a basic diagram and to export it as a `.png` file\r\n\r\n```python\r\nimport packetdiagram\r\n\r\n# Create a new diagram\r\nmy_diagram = packetdiagram.Diagram()\r\n\r\n# Add a packet to the diagram\r\npacket = my_diagram.add_new_packet(\"Ethernet Frame\")\r\n\r\n# Add fields to the packet\r\npacket.add_field(\"Destination MAC\", 7)\r\npacket.add_field(\"Source MAC\", 7)\r\npacket.add_field(\"Ether-Field\", 5)\r\nparent_field = packet.add_field(\"Packet\", 10)\r\npacket.add_field(\"FCS\", 2)\r\n\r\n# Add another packet to the diagram\r\npacket = my_diagram.add_new_packet(\"Ethernet Frame\")\r\n\r\n# Set packet parent field\r\npacket.set_parent(parent_field)\r\n\r\n# Add fields to the second packet\r\npacket.add_field(\"Source IP\", 6)\r\npacket.add_field(\"Destination IP\", 6)\r\npacket.add_field(\"Protocol\", 6)\r\npacket.add_field(\"...\", 4)\r\npacket.add_field(\"Segment\", 6)\r\n\r\n# Draw the diagram and saves it\r\nmy_diagram.draw_to_file(\"ethernet_frame.png\")\r\n```\r\n\r\n**Result :**\r\n\r\n![Basic diagram example](https://raw.githubusercontent.com/JoramFC/packetdiagram/main/docs/images/ethernet_frame.png \"Basic diagram - Ethernet frame\")\r\n\r\n## \ud83e\udd1d Contributing\r\n\r\nContributions are welcome! Here's how you can contribute:\r\n\r\n1. Report a Bug: Open an issue on GitHub.\r\n2. Suggest an Improvement: Open a pull request.\r\n3. Improve Documentation: Any help to improve this README or add examples is appreciated.\r\n\r\n## \ud83d\udcc4 License\r\n\r\nThis project is licensed under the MIT License. See the LICENSE file for more details.\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A tool to generate packet diagrams and save them as png or svg.",
    "version": "0.0.1",
    "project_urls": {
        "Homepage": "https://github.com/JoramFC/packetdiagram"
    },
    "split_keywords": [
        "diagram",
        " packet",
        " visualization"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "1bf0572170019e92954f71a673ddbefccc7660f9fe50f423cd8ea25d592b3e0a",
                "md5": "5044739c72fd43a195969795fd6312da",
                "sha256": "a31ecd77502f2b7ef7ceeb4bf5a8f488fdef94fc5a6432cf6643cdd0b72e1dd8"
            },
            "downloads": -1,
            "filename": "packetdiagram-0.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5044739c72fd43a195969795fd6312da",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 7575,
            "upload_time": "2025-09-05T17:17:01",
            "upload_time_iso_8601": "2025-09-05T17:17:01.812922Z",
            "url": "https://files.pythonhosted.org/packages/1b/f0/572170019e92954f71a673ddbefccc7660f9fe50f423cd8ea25d592b3e0a/packetdiagram-0.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "e633c580800cb133afed9206abb90d7a104fb628758c752c181b24c73bcf45ca",
                "md5": "ff7bc626b89afcf0cf660ca4723ff880",
                "sha256": "314ae1f1a366b2ce89bd93249e54f862253fd50d328f94bb83b6564cbe7ec2c9"
            },
            "downloads": -1,
            "filename": "packetdiagram-0.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "ff7bc626b89afcf0cf660ca4723ff880",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 6454,
            "upload_time": "2025-09-05T17:17:03",
            "upload_time_iso_8601": "2025-09-05T17:17:03.208833Z",
            "url": "https://files.pythonhosted.org/packages/e6/33/c580800cb133afed9206abb90d7a104fb628758c752c181b24c73bcf45ca/packetdiagram-0.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-05 17:17:03",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "JoramFC",
    "github_project": "packetdiagram",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "packetdiagram"
}
        
Elapsed time: 1.16335s