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 of develop (a plain clone is the released main), for unreleased changes and development:

git clone -b develop 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')
>>> 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, the engine and the output are keyword arguments to the same call. A report is written only when dump asks for one; flow tracing writes each flow under ./tmp, or the fout of a TraceFlowOptions passed as traceflow:

>>> from pcapkit import DumpOptions
>>> scapy = pcapkit.extract('in.pcap', engine='scapy')
>>> reasm = pcapkit.extract('in.pcap', reassembly=['ipv6'])
>>> flows = pcapkit.extract('in.pcap', traceflow=['tcp'])
>>> len(flows.traceflow.tcp)
2
>>> report = pcapkit.extract('in.pcap', dump=DumpOptions(fout='out.json', format='json'))

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.8.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.8.0
File Size Uploaded Provenance Actions
pypcapkit-1.8.0.tar.gz 6.0 MB Without provenance Details for pypcapkit-1.8.0.tar.gz

Built distributions (wheels)

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

Total release size: 26.0 MB

Release files / pypcapkit-1.8.0.tar.gz

Download URL pypcapkit-1.8.0.tar.gz
Size 6.0 MB
Tags Source
SHA-256 checksum
How to use checksums
ad7cf4b551c0898bfa4f4b2d2746ded6ca97198bc64663a13fa7bed93c9ee252
BLAKE2b-256 checksum
How to use checksums
841c15ebb10f06aa2672cc987502e24241c2641411191f4c48d3f28178a05e27
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.8.0-pp312-none-any.whl

Download URL pypcapkit-1.8.0-pp312-none-any.whl
Size 2.5 MB
Tags PyPy 3.12
SHA-256 checksum
How to use checksums
a81fff38be9095bab17c55e177a58c246fc1156c544de92919d7110200fdb3d3
BLAKE2b-256 checksum
How to use checksums
3eed4528a67cf6dc334efed046e4e4f93fd4fc75df76a944d0129b8bb2ed1ca4
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.8.0-pp311-none-any.whl

Download URL pypcapkit-1.8.0-pp311-none-any.whl
Size 2.5 MB
Tags PyPy 3.11
SHA-256 checksum
How to use checksums
a0252adb92a2a5859ae29a8d46cc8dc0e7f90685cbc2122f985f53429a81323a
BLAKE2b-256 checksum
How to use checksums
883f4936b12a0ee9b1c5d0c9d5ae85072382e95da2c38b861b9274b62c062134
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.8.0-cp315-none-any.whl

Download URL pypcapkit-1.8.0-cp315-none-any.whl
Size 2.5 MB
Tags CPython 3.15
SHA-256 checksum
How to use checksums
f2699c149b664569ea3e9c1e09e610d8728089b4b9d1761b4226a5867f6dc2ad
BLAKE2b-256 checksum
How to use checksums
65befcfc3c4af9e8bfc144a42f7bf4843646cb6bc009de854cf2497bcca7e5aa
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.8.0-cp314-none-any.whl

Download URL pypcapkit-1.8.0-cp314-none-any.whl
Size 2.5 MB
Tags CPython 3.14
SHA-256 checksum
How to use checksums
8f913bb494dfe0dca52070a8289fc07a3509fe40058210a2931619da1f57c33d
BLAKE2b-256 checksum
How to use checksums
77d5b0a5403b687015d91041f79a744299760e87ab5f29e0451215d94b4b0d60
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.8.0-cp313-none-any.whl

Download URL pypcapkit-1.8.0-cp313-none-any.whl
Size 2.5 MB
Tags CPython 3.13
SHA-256 checksum
How to use checksums
96df49ca1ea94c3c6013b95d16f665742b1f62cc58dc3009733160a4978f8587
BLAKE2b-256 checksum
How to use checksums
469c0f654c1fbdaaa753fb552e75e419af8c523850e59a646bca0e0efad3bcf8
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.8.0-cp312-none-any.whl

Download URL pypcapkit-1.8.0-cp312-none-any.whl
Size 2.5 MB
Tags CPython 3.12
SHA-256 checksum
How to use checksums
6117549fca03bae83fd3e0cf02fdf1714afd5f53cbe567f4709899f5295b7e99
BLAKE2b-256 checksum
How to use checksums
70ab6c0e168222bd734175e321f9ac6941fec77264a90a69d8be2efd3c39463d
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.8.0-cp311-none-any.whl

Download URL pypcapkit-1.8.0-cp311-none-any.whl
Size 2.5 MB
Tags CPython 3.11
SHA-256 checksum
How to use checksums
75fae1b59ba4090c59691db8b6d18b53b2e32f982d17481cb5f42d812e976b52
BLAKE2b-256 checksum
How to use checksums
e2ea501bd2c85bc07dcc3fb1c2ab1fe2bb88d14e5549e100bd63bee24dd7ceba
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.8.0-cp310-none-any.whl

Download URL pypcapkit-1.8.0-cp310-none-any.whl
Size 2.5 MB
Tags CPython 3.10
SHA-256 checksum
How to use checksums
ac64f7aa479cc870c4a3291843f066cca0ecdef7a1f8d1ff637fe78d7dc26c3d
BLAKE2b-256 checksum
How to use checksums
a180b8d335e3076e63a117993446fa853b7dbcaac3cf00bee095b9d35dcf36f7
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.8.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.8.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