skillfed

dpkt

fast, simple packet creation / parsing, with definitions for the basic TCP/IP protocols

dpkt v1.9.8 1.7M downloads/30d#3,616 on PyPI1,159
Permissive license BSD DORMANT released

What it is and what it does

dpkt is a Python module for parsing and constructing packets at the TCP/IP protocol level. It provides definitions for basic protocols (Ethernet, IP, TCP, UDP, and others) and allows you to unpack raw bytes into structured protocol objects or build packets from scratch. The library has no runtime dependencies and is designed for speed and simplicity, making it suitable for network analysis, packet inspection, and protocol-level debugging.

The project entered dormancy after its 2022 release but remains functional and stable. It supports Python 2.7 through 3.9 (classifiers list these versions), though the lack of recent updates means it may not cover the latest protocol extensions or edge cases. It is widely used in network security, packet capture analysis, and educational contexts where direct protocol-level access is needed.

Use it for:

  • Analyze captured network traffic (pcap files) by parsing Ethernet, IP, TCP, UDP, and application-layer protocols.
  • Build custom network packets for testing, fuzzing, or protocol validation without external dependencies.
  • Extract and inspect protocol headers from raw bytes in network monitoring or IDS/IPS tools.
  • Educational projects or reverse-engineering tasks requiring low-level packet inspection.
  • Integrate packet parsing into security research or penetration testing workflows.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

dpkt parses and creates TCP/IP protocol packets with minimal dependencies, enabling fast inspection and manipulation of network traffic at the protocol level.

Yes, if you need lightweight, dependency-free packet parsing for network analysis or protocol work. The dormant status is not a blocker—the library is stable and feature-complete for standard TCP/IP protocols. Install it when you want to avoid heavier frameworks like Scapy or when you need minimal overhead. Verify that its protocol coverage matches your specific use case, especially for newer or less common protocols.

Install

dpkt on PyPI

pip

pip install dpkt

uv

uv add dpkt

poetry

poetry add dpkt

Installing dpkt

Before you install

Installation is straightforward with no runtime dependencies. The project is dormant (last release 2022-08-18, 1457 days ago) but remains stable and archived repository is not flagged, suggesting it is feature-complete rather than abandoned.

License in practice

BSD license is permissive, allowing commercial and private use with minimal restrictions—suitable for most projects that can include a license notice.

Quickstart

pip install dpkt

import dpkt

# Parse an Ethernet frame
eth = dpkt.ethernet.Ethernet(raw_packet_bytes)
ip = eth.data
print(ip.src, ip.dst)

Verify before relying

  • Whether the package actively handles modern protocol variants (e.g., IPv6 extensions, newer TCP options) given dormant maintenance status.
  • Performance characteristics on large packet volumes or real-time capture scenarios compared to alternatives.

Package facts

License BSD (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance dormant — 1,457 days since the last release
Last repo commit
First released
Downloads 1,722,501/month — #3,616 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: dpkt-1.9.8-py3-none-any.whl

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseNatural Language :: EnglishProgramming Language :: Python :: 2.7Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPy

Tags

packet parsing pythontcp ip protocol parsingnetwork packet dissectionraw packet inspectionprotocol buffer parsingnetwork traffic analysispacket creation library
network-analysispacket-parsinglow-dependency

More Networking packages