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 output dumper.

Compared with 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 drives those tools as third-party extraction engines.

Requires Python 3.8 or later. CI supports 3.11 to 3.15, and 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 unreleased changes and 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)

Some engines need more than pip install -- a tshark binary, a C compiler, libpcap headers, or an older interpreter -- and pypcap and pcap-ct must not be installed together. The engine prerequisites give each constraint and its reason. Asking for an engine that cannot run here warns with the cause and falls back to pcapkit's 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:ICMPv6'
>>> 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.

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

Pages of the official documentation 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; contribution guidelines are in CONTRIBUTING.md.

Metadata

Release files for pypcapkit 1.6.1.post1

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.6.1.post1
File Size Uploaded Provenance Actions
pypcapkit-1.6.1.post1.tar.gz 5.5 MB Without provenance Details for pypcapkit-1.6.1.post1.tar.gz

Built distributions (wheels)

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

Total release size: 24.2 MB

Release files / pypcapkit-1.6.1.post1.tar.gz

Download URL pypcapkit-1.6.1.post1.tar.gz
Size 5.5 MB
Tags Source
SHA-256 checksum
How to use checksums
8950d3c5f4db788e4a8507efd9b82ab5d59d33d5a709aa830d67a52f7bf0ac3b
BLAKE2b-256 checksum
How to use checksums
e8a73b5fd8ac82a25804202d483d96369857944c4f204b9b126f55c1cc8f2d73
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.6.1.post1-pp311-none-any.whl

Download URL pypcapkit-1.6.1.post1-pp311-none-any.whl
Size 2.3 MB
Tags PyPy 3.11
SHA-256 checksum
How to use checksums
405e03d31874d27593514dfa755402b631725815bfe0070c5d0b8d30a1b69ad9
BLAKE2b-256 checksum
How to use checksums
4e5d2ec96d3c59faa6b5ec995383da8864defff746b42978d3d0f3bfd282ab2f
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.6.1.post1-pp310-none-any.whl

Download URL pypcapkit-1.6.1.post1-pp310-none-any.whl
Size 2.3 MB
Tags PyPy 3.10
SHA-256 checksum
How to use checksums
2db966070630dc307ca6ad5bbdf674f5fdbf359ecc8b9931f54f4e994b41982a
BLAKE2b-256 checksum
How to use checksums
36d97d01bd016683b71e858cdabed286358fbd958a43ce5f8bfcdd50f4f44d5c
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.6.1.post1-cp315-none-any.whl

Download URL pypcapkit-1.6.1.post1-cp315-none-any.whl
Size 2.3 MB
Tags CPython 3.15
SHA-256 checksum
How to use checksums
6c95ade33343622ce7429fe3b2621bde95c683b4669e3193bbecb4754c0d54d1
BLAKE2b-256 checksum
How to use checksums
d6f05351b60132907eaf277f09ef2db871e2e3a645c92002e161c098d0b4d43f
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.6.1.post1-cp314-none-any.whl

Download URL pypcapkit-1.6.1.post1-cp314-none-any.whl
Size 2.3 MB
Tags CPython 3.14
SHA-256 checksum
How to use checksums
0702489ec03fa307f5ece2ab14722eae16dbca8de6e61a5e4a5b8d2e698fbdb6
BLAKE2b-256 checksum
How to use checksums
f3cf9f72681565d5fdf120982847f85c430db82e0d2aaa088f309faddde2afc4
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.6.1.post1-cp313-none-any.whl

Download URL pypcapkit-1.6.1.post1-cp313-none-any.whl
Size 2.3 MB
Tags CPython 3.13
SHA-256 checksum
How to use checksums
130191dea3e1d2b836590e24ce46c7fc9d0162881c739be3009289bad37ac99e
BLAKE2b-256 checksum
How to use checksums
feab090a573ff99d05872f9bd2726fd2c9ab848665adb0d953ff164f44bdd546
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.6.1.post1-cp312-none-any.whl

Download URL pypcapkit-1.6.1.post1-cp312-none-any.whl
Size 2.3 MB
Tags CPython 3.12
SHA-256 checksum
How to use checksums
a441cd501f408501ae8c4e4715534ab06374c4e4a80b7326c5eb77fb3fb16fb1
BLAKE2b-256 checksum
How to use checksums
3ac55c1d5c9f39a397eaebab87d47cb280d72f50626860025d09829cbe572f05
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.6.1.post1-cp311-none-any.whl

Download URL pypcapkit-1.6.1.post1-cp311-none-any.whl
Size 2.3 MB
Tags CPython 3.11
SHA-256 checksum
How to use checksums
729622f749e1ba9fae6fc1cb8ba227a64c2fd607d5c7fe96e5205162ccc1c612
BLAKE2b-256 checksum
How to use checksums
d84f706963f0262d196fe440fb411d1682cec0c0c0d844a8debaba6087eb17fd
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.6.1.post1-cp310-none-any.whl

Download URL pypcapkit-1.6.1.post1-cp310-none-any.whl
Size 2.3 MB
Tags CPython 3.10
SHA-256 checksum
How to use checksums
f31168f96e5f8220585a071d3ec0d861006a9a7c3e3bef9f97839be9ab5076cf
BLAKE2b-256 checksum
How to use checksums
b7b268e59ee7d1deccfa85cf64fa94cf0c1e3e6ff03610260eb2725dedf41fd6
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.6.1.post1

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
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