Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

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 six third-party extraction engines.

The whole project declares Python 3.6 or later. CI supports 3.11 to 3.15, and still tests the end-of-life 3.7 to 3.10 without letting a failure block anything; 3.7 cannot import the package yet.

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. Four 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 installation guide gives 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)
3

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 of the nine subpackages is for
Engine comparison Which engines exist, which Python versions they run on, and measured speed per packet
Engine support What each engine does not support, and how the gap is surfaced
Installation Extras, engine prerequisites 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

Release history is in CHANGELOG.md, and contribution guidelines are in CONTRIBUTING.md.

Metadata

Release files for pypcapkit 1.5.0b12

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.0b12
File Size Uploaded
pypcapkit-1.5.0b12.tar.gz 3.8 MB Details

Built distributions (wheels)

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

Total release size: 18.3 MB

Release files / pypcapkit-1.5.0b12.tar.gz

Download URL pypcapkit-1.5.0b12.tar.gz
Size 3.8 MB
Tags Source
SHA-256 checksum
How to use checksums
b19ba2997a8bf67b7a784a8b158cc4773d95460b9eaf5a0dcb8ae2d8b788a08a
BLAKE2b-256 checksum
How to use checksums
ad44a4c28920d525098127a5f836f892a26ab016e3b99c2aa8318caf5fe58249
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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

Download URL pypcapkit-1.5.0b12-pp311-none-any.whl
Size 1.8 MB
Tags PyPy 3.11
SHA-256 checksum
How to use checksums
6efbb7d86ad0bdf124ac8477e847f695443716d715e937adb79c3d9ed520d72b
BLAKE2b-256 checksum
How to use checksums
1b0c44130b190e9d25f98b9e3d19f5d34380fda81fa30553d5f189e5097c91f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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

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

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

Download URL pypcapkit-1.5.0b12-cp315-none-any.whl
Size 1.8 MB
Tags CPython 3.15
SHA-256 checksum
How to use checksums
75badc76476fe4ed37e58ba3743017a0885938b8462e6734f6dbb7bcd4cd8adf
BLAKE2b-256 checksum
How to use checksums
d61151506c8b073ddc0e3cadb124b351bf7ee24d1a0f4792ee01cf5993fd4998
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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

Download URL pypcapkit-1.5.0b12-cp314-none-any.whl
Size 1.8 MB
Tags CPython 3.14
SHA-256 checksum
How to use checksums
a9d4d483914db3f28f3d3c4ca5a3e740e6ee50bf175de7c004b3a403107ada38
BLAKE2b-256 checksum
How to use checksums
1db26c0fd4f5b093bb5eb4337af4fde9a6860ff78b2770ab88fd5562eb0d4315
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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

Download URL pypcapkit-1.5.0b12-cp313-none-any.whl
Size 1.8 MB
Tags CPython 3.13
SHA-256 checksum
How to use checksums
3c576149f91dd78859578baea3a1ca72e2782a11169d4503df21a1030cb1636c
BLAKE2b-256 checksum
How to use checksums
077a090bf3a203ca77a2c09b1f04cc4446e8be4692aed115a819c7e37b6832e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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

Download URL pypcapkit-1.5.0b12-cp312-none-any.whl
Size 1.8 MB
Tags CPython 3.12
SHA-256 checksum
How to use checksums
d3bf6ff5d2e90cdf7cc6bb1bf6889f98f6b9e022b11b391c4d96b9ed62d9329b
BLAKE2b-256 checksum
How to use checksums
4faf6d4583e7aedde9e6e89da41158b60e0c114814650ac9839501f126f7a0df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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

Download URL pypcapkit-1.5.0b12-cp311-none-any.whl
Size 1.8 MB
Tags CPython 3.11
SHA-256 checksum
How to use checksums
887ca3914b5a47d7cf7d7358f96cd0ecffcba894403ef7073676fa90523c7078
BLAKE2b-256 checksum
How to use checksums
dd081d3d16663e8d7da50ef8bdeb4792d20d26018f6f8b0bd6280d860f763320
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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

Download URL pypcapkit-1.5.0b12-cp310-none-any.whl
Size 1.8 MB
Tags CPython 3.10
SHA-256 checksum
How to use checksums
102542a0d6d3f1666c5ff1acf8b7f49429e7e946572f078f3a22621f455f3499
BLAKE2b-256 checksum
How to use checksums
d41d870d6e2ea66fd13cff729d3f4affdf2cf52fbf8ea704fab33cdd383a04f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

1.5.0b12 This release

9 release files

1.4.1

8 release files

1.4.0

8 release files

1.3.5

8 release files

1.3.4

9 release files

1.3.3

7 release files

1.3.1

6 release files

1.3.0

7 release files

1.2.2

6 release files

1.2.1

7 release files

1.2.0

7 release files

1.1.1

7 release files

1.1.0

7 release files

1.0.3

6 release files

1.0.2

5 release files

1.0.1

2 release files

1.0.0

2 release files

0.16.2

1 release file

0.16.1

1 release file

0.16.0

1 release file

0.15.5

2 release files

0.15.4

2 release files

0.15.3

2 release files

0.15.2

2 release files

0.15.1

2 release files

0.12.9

3 release files

0.12.8

3 release files

0.12.7

3 release files

0.12.6

3 release files

0.12.5

2 release files

0.12.2

2 release files

0.12.1

2 release files

0.12.0

2 release files

0.11.3

2 release files

0.11.2

2 release files

0.10.2

2 release files

0.10.1

2 release files

0.10.0

2 release files

0.9.10

2 release files

0.9.9

2 release files

0.9.8

2 release files

0.9.7

2 release files

0.9.6

2 release files

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