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

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

Built distributions (wheels)

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

Total release size: 28.8 MB

Release files / pypcapkit-1.8.1.tar.gz

Download URL pypcapkit-1.8.1.tar.gz
Size 6.0 MB
Tags Source
SHA-256 checksum
How to use checksums
fda129462afad5336d029038a160bb51eab38f02338f3c7a3da8ebd8834b7ea7
BLAKE2b-256 checksum
How to use checksums
895e7df022d34a6d336685ab3a9d291a5696aa066fcd83091f35b278db59791e
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.1-pp312-none-any.whl

Download URL pypcapkit-1.8.1-pp312-none-any.whl
Size 2.5 MB
Tags PyPy 3.12
SHA-256 checksum
How to use checksums
f30266646545f47d098e8d231d1ef196b08426433948c523af6bcecf26e1e212
BLAKE2b-256 checksum
How to use checksums
0fa0dfdce598cbd6bd74971f8e99ce8b1b371d3a6d382980e0187a86edd2b43b
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.1-pp311-none-any.whl

Download URL pypcapkit-1.8.1-pp311-none-any.whl
Size 2.5 MB
Tags PyPy 3.11
SHA-256 checksum
How to use checksums
d73d1cfed4ee4135309835867a950baf1fdca135f78d6114cd95b9d3c1d8ade0
BLAKE2b-256 checksum
How to use checksums
3e5023c160db7c09efbd411dec68b3383bf1f2a87a15eff728fd33ea3185b6aa
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.1-pp310-none-any.whl

Download URL pypcapkit-1.8.1-pp310-none-any.whl
Size 2.5 MB
Tags PyPy 3.10
SHA-256 checksum
How to use checksums
abac6c2d4fe5a91651c163ac48dfc3116ccbe0305e7f06486b84c1e5bb509bc2
BLAKE2b-256 checksum
How to use checksums
caba14cd8b57ae84c6775daf212795ef4f9d7888ad3b9fac9229850975e83234
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.1-cp315-none-any.whl

Download URL pypcapkit-1.8.1-cp315-none-any.whl
Size 2.5 MB
Tags CPython 3.15
SHA-256 checksum
How to use checksums
e9592406a26839de9888ead310943fb123487999bc91190d6ee6c4efdb95b1b1
BLAKE2b-256 checksum
How to use checksums
21ba731f0e1bda922130cec578b89f0cd48516d4b7ae42e15a07f4a48722b114
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.1-cp314-none-any.whl

Download URL pypcapkit-1.8.1-cp314-none-any.whl
Size 2.5 MB
Tags CPython 3.14
SHA-256 checksum
How to use checksums
45ed479734aaea8aaccdb26ad2487a43962699ba30d249199fc4180932c9016d
BLAKE2b-256 checksum
How to use checksums
48035ece73eb1bf935d89ec4ad892b085b5b994dfecdc7986f9a2a22e5455589
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.1-cp313-none-any.whl

Download URL pypcapkit-1.8.1-cp313-none-any.whl
Size 2.5 MB
Tags CPython 3.13
SHA-256 checksum
How to use checksums
77fcfd71c4d8b4ced7db771759f47378ef30044f7e3a4c52a94dec724787a06b
BLAKE2b-256 checksum
How to use checksums
4c8f8a20ec6a2177d95c3d2101ddea408ca7963ec8570697e3c06fa80813f03c
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.1-cp312-none-any.whl

Download URL pypcapkit-1.8.1-cp312-none-any.whl
Size 2.5 MB
Tags CPython 3.12
SHA-256 checksum
How to use checksums
c1b738fcd585c0d4972d9b139d196ef3339a603d63af24083c734307b04dbbdb
BLAKE2b-256 checksum
How to use checksums
09a408d14cccdfee3641cc60f40b5075feb430de6831c83211b1634fdf403d63
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.1-cp311-none-any.whl

Download URL pypcapkit-1.8.1-cp311-none-any.whl
Size 2.5 MB
Tags CPython 3.11
SHA-256 checksum
How to use checksums
d15b3b87a9e49ca6c62612c7767ea111f7d62690438e0b5c43296fb2ba49f86f
BLAKE2b-256 checksum
How to use checksums
763dd227e58955d21cfa3307c1b074843c17b3721e1b7f24e4838ef9de1c160c
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.1-cp310-none-any.whl

Download URL pypcapkit-1.8.1-cp310-none-any.whl
Size 2.5 MB
Tags CPython 3.10
SHA-256 checksum
How to use checksums
fab94bea111bb1bd5b61bd50355a645a27e2437aa8fc97e41a1d48564e11c6c9
BLAKE2b-256 checksum
How to use checksums
a044b518a715037fdb1e0c847f21bdd1d1f2238ec7060b8e8c279f3032ba616a
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.1

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.1 This release

10 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