dpkt
fast, simple packet creation / parsing, with definitions for the basic TCP/IP protocols
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 dpktuv
uv add dpktpoetry
poetry add dpktInstalling 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
Tags
More Networking packages
h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
psutilpsutil retrieves real-time information about…
permissive · top 1,000 on PyPI
pyOpenSSLpyOpenSSL wraps OpenSSL's SSL/TLS functionality…
permissive · top 1,000 on PyPI
uvloopuvloop is a drop-in replacement for Python's…
permissive · top 1,000 on PyPI
execnetexecnet lets you spawn and communicate with…
permissive · top 1,000 on PyPI
pyzmqPyZMQ provides Python bindings for ZeroMQ…
permissive · top 1,000 on PyPI
impacketImpacket provides low-level Python classes for…
permissive · top 15,000 on PyPI
pmd-net-protoParses, assembles, and validates network…
copyleft · top 15,000 on PyPI
scapyScapy is a Python library for forging,…
copyleft · top 5,000 on PyPI
pysharkPyshark wraps tshark (Wireshark's command-line…
permissive · top 5,000 on PyPI
pypcapPython wrapper around libpcap that lets you…
unclear · top 15,000 on PyPI
pydivertPyDivert is a Python binding for the WinDivert…
copyleft · top 15,000 on PyPI
rtpDecodes, encodes, and manipulates RTP…
permissive · top 15,000 on PyPI
pingparsingExecutes and parses ping command output,…
permissive · top 15,000 on PyPI
pure-pcapy3Pure-Python implementation of the pcapy API for…
permissive · top 15,000 on PyPI
pythonpingSends ICMP ping requests to remote hosts from…
permissive · top 15,000 on PyPI