Skip to main content

PyPCAPKit -- Comprehensive Network Packet Analysis Library

For technical and maintenance information, see the Official Documentation.

PyPCAPKit is an open-source Python library for parsing, constructing and analysing network packets and PCAP files, with DictDumper as its formatted output dumper.

Unlike popular PCAP extractors such as Scapy, DPKT and PyShark, pcapkit reports more detail about each packet through a more Pythonic interface. Where that depth is not needed, the same interface also drives third-party extraction engines.

The whole project requires Python 3.8 or later. CI supports 3.11 to 3.15, and still tests the end-of-life 3.8 to 3.10 without letting a failure block anything.

Installation

pip install pypcapkit

Or from a clone, for the latest version and for development:

git clone https://github.com/JarryShaw/PyPCAPKit.git
cd PyPCAPKit
pip install -e .

The extraction engines and plug-ins are optional extras:

pip install pypcapkit[DPKT]         # or Scapy, PyShark, PyPCAPFile, PyPCAP, PCAP_CT
pip install pypcapkit[crypto]       # ESP payload decryption
pip install pypcapkit[cli]          # command line interface
pip install pypcapkit[all]          # core addons only: cli + crypto + NGAP (pycrate)

Engines are on demand; all bundles only the core addons the library needs for full functionality. Some engines also need something beyond pip install -- a tshark binary, a C compiler, libpcap headers, or an older interpreter -- and pypcap/pcap-ct must never be installed together. The engine prerequisites give each constraint and its reason. pcapkit enforces them in code: asking for an engine that cannot run in the current environment warns with the cause and falls back to its own parser.

Usage

>>> import pcapkit
>>> extraction = pcapkit.extract('in.pcap', nofile=True)
>>> len(extraction.frame)
6
>>> frame = extraction.frame[0]
>>> str(frame.protochain)
'Ethernet:IPv6:IPv6_ICMP'
>>> frame.info.time
datetime.datetime(2017, 11, 19, 15, 49, 5, 471719, tzinfo=datetime.timezone.utc)
>>> frame.payload.payload.src
IPv6Address('fe80::a6:87f9:2793:16ee')

The output is from the committed examples/captures/in.pcap, so it is reproducible from a clone.

Reassembly, TCP flow tracing and the engine are keyword arguments to the same call:

>>> scapy = pcapkit.extract('in.pcap', nofile=True, engine='scapy')
>>> reasm = pcapkit.extract('in.pcap', nofile=True, reassembly=True, ipv6=True)
>>> flows = pcapkit.extract('in.pcap', nofile=True, trace=True, tcp=True)
>>> len(flows.trace.tcp)
2

More examples, including the command line interface, are in How to ....

Documentation

The official documentation is the reference. Pages worth knowing by name:

Page What is in it
API reference Every module, protocol and constant
Module structure What each subpackage is for
Engine comparison Which engines exist, which Python versions they run on, what each needs installed, and measured speed per packet
Engine support What each engine does not support, and how the gap is surfaced
Installation Extras and the local development setup
Testing Running the suite, and the sample captures it needs
How to ... Worked examples, library and CLI
Extensions Registering your own protocols, engines and dumpers

The newest changelog entry is in CHANGELOG.md, which links to the full history, and contribution guidelines are in CONTRIBUTING.md.

Metadata

Release files for pypcapkit 1.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pypcapkit 1.5.0
File Size Uploaded Provenance Actions
pypcapkit-1.5.0.tar.gz 4.8 MB Without provenance Details for pypcapkit-1.5.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for pypcapkit 1.5.0
File Actions
pypcapkit-1.5.0-pp311-none-any.whl PyPy 3.11 none any Details for pypcapkit-1.5.0-pp311-none-any.whl
pypcapkit-1.5.0-pp310-none-any.whl PyPy 3.10 none any Details for pypcapkit-1.5.0-pp310-none-any.whl
pypcapkit-1.5.0-cp315-none-any.whl CPython 3.15 none any Details for pypcapkit-1.5.0-cp315-none-any.whl
pypcapkit-1.5.0-cp314-none-any.whl CPython 3.14 none any Details for pypcapkit-1.5.0-cp314-none-any.whl
pypcapkit-1.5.0-cp313-none-any.whl CPython 3.13 none any Details for pypcapkit-1.5.0-cp313-none-any.whl
pypcapkit-1.5.0-cp312-none-any.whl CPython 3.12 none any Details for pypcapkit-1.5.0-cp312-none-any.whl
pypcapkit-1.5.0-cp311-none-any.whl CPython 3.11 none any Details for pypcapkit-1.5.0-cp311-none-any.whl
pypcapkit-1.5.0-cp310-none-any.whl CPython 3.10 none any Details for pypcapkit-1.5.0-cp310-none-any.whl

Total release size: 20.3 MB

Release files / pypcapkit-1.5.0.tar.gz

Download URL pypcapkit-1.5.0.tar.gz
Size 4.8 MB
Tags Source
SHA-256 checksum
How to use checksums
87bda53767139b812df0ea7f83269d2fc81c027cf6aa6820da4965a9c90b8062
BLAKE2b-256 checksum
How to use checksums
6165ee4d31f65d20eba5f90706d3b1eb5b3f6ba9eccb1d5867cd8d528eed54a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pypcapkit-1.5.0-pp311-none-any.whl

Download URL pypcapkit-1.5.0-pp311-none-any.whl
Size 1.9 MB
Tags PyPy 3.11
SHA-256 checksum
How to use checksums
b227bb8cf93c48165d1c94290b95f3267d1de336c0ce6f47f2d0c298e815a8d7
BLAKE2b-256 checksum
How to use checksums
ca7dd89ef0b41251fd3fbd604fd9e0358e2b3bfdacb3c8b7305036e61ed2652f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pypcapkit-1.5.0-pp310-none-any.whl

Download URL pypcapkit-1.5.0-pp310-none-any.whl
Size 1.9 MB
Tags PyPy 3.10
SHA-256 checksum
How to use checksums
bb2fb4b33be37364f935fb2436a9a104c5523e8aa661dda36d9e04899dec8d1d
BLAKE2b-256 checksum
How to use checksums
b45e4fc1ac27c41829a26145e539e350bfe96dd8ee74cee50e8ebd18ea81304a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pypcapkit-1.5.0-cp315-none-any.whl

Download URL pypcapkit-1.5.0-cp315-none-any.whl
Size 1.9 MB
Tags CPython 3.15
SHA-256 checksum
How to use checksums
884301acce68fee6db6873ca070ce94dbee0f7058aca980af58354eb0f82eb28
BLAKE2b-256 checksum
How to use checksums
e154dd9c1124651c3662a9094b5989717e4a34830b9f16de074c42f2323c0731
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pypcapkit-1.5.0-cp314-none-any.whl

Download URL pypcapkit-1.5.0-cp314-none-any.whl
Size 1.9 MB
Tags CPython 3.14
SHA-256 checksum
How to use checksums
c14b72051b482790b709fd36d3075269fc8820fc9e2eba277e2f5bc15877b29f
BLAKE2b-256 checksum
How to use checksums
baab085081a9fb0d82dd1219c4b84c7a18de35d37914f91f3d24e7a5e104769e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pypcapkit-1.5.0-cp313-none-any.whl

Download URL pypcapkit-1.5.0-cp313-none-any.whl
Size 1.9 MB
Tags CPython 3.13
SHA-256 checksum
How to use checksums
4e635644b093b5917ee1a2f3ab0e2ca32ca19eacb82c41343cc2391e19015988
BLAKE2b-256 checksum
How to use checksums
c9c52118c119d1ac4a3810af67397eacb3cedfa921cfe30a41324699fd8f92b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pypcapkit-1.5.0-cp312-none-any.whl

Download URL pypcapkit-1.5.0-cp312-none-any.whl
Size 1.9 MB
Tags CPython 3.12
SHA-256 checksum
How to use checksums
f6638fae306916195a5831e842cc3c664ffb1a595ee7b57e538b60fe5345b945
BLAKE2b-256 checksum
How to use checksums
d5bd8840d4b8e810f5b55c07100bed6b458aa6ca7dd1f02de0daa166fdc91b8b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pypcapkit-1.5.0-cp311-none-any.whl

Download URL pypcapkit-1.5.0-cp311-none-any.whl
Size 1.9 MB
Tags CPython 3.11
SHA-256 checksum
How to use checksums
e0b192ee7feec463e4cd702b13ec6508da74d1d6e29864cbae01b93bad847cbc
BLAKE2b-256 checksum
How to use checksums
950c362185871b15f58e8026e8c859da3d2a85cc52f6b1a1e197fc87bbbf48db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pypcapkit-1.5.0-cp310-none-any.whl

Download URL pypcapkit-1.5.0-cp310-none-any.whl
Size 1.9 MB
Tags CPython 3.10
SHA-256 checksum
How to use checksums
322a5f268ca8df276c1cf4605dea7dc6b09ae29b4e929cdb5afd621a70f52245
BLAKE2b-256 checksum
How to use checksums
9e500f9995a8111d4dbcc59e2a5c230b4c4248e9bf8028b1623f80784af643d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Security for pypcapkit 1.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.5.0 This release

9 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page