Skip to main content

PyPCAPKit: comprehensive network packet analysis library

Project description

For any technical and/or maintenance information, please kindly refer to the Official Documentation.

The PyPCAPKit project is an open source Python program focus on network packet parsing and analysis, which works as a comprehensive PCAP file extraction, construction and analysis library.

The whole project supports Python 3.6 or later.

About

PyPCAPKit is a comprehensive Python-native network packet analysis library, with DictDumper as its formatted output dumper.

Unlike popular PCAP file extractors, such as Scapy, DPKT, PyShark, and etc, pcapkit uses streaming strategy to read input files. That is to read frame by frame, decrease occupation on memory, as well as enhance efficiency in some way.

Module Structure

In pcapkit, all files can be described as following eight parts.

  • Interface (pcapkit.interface)

    User interface for the pcapkit library, which standardises and simplifies the usage of this library.

  • Foundation (pcapkit.foundation)

    Synthesises file I/O and protocol analysis, coordinates information exchange in all network layers, as well as provides the foundamental functions for pcapkit.

  • Protocols (pcapkit.protocols)

    Collection of all protocol family, with detailed implementation and methods.

  • Utilities (pcapkit.utilities)

    Auxiliary functions and tools for pcapkit.

  • CoreKit (pcapkit.corekit)

    Core utilities for pcapkit implementation, mainly for internal data structure and processing.

  • ToolKit (pcapkit.toolkit)

    Auxiliary tools for pcapkit to support the multiple extraction engines with a unified interface.

  • DumpKit (pcapkit.dumpkit)

    File output formatters for pcapkit.

  • Constants (pcapkit.const)

    Constant enumerations used in pcapkit for protocol family extraction and representation.

Engine Comparison

Due to the general overhead of pcapkit, its extraction procedure takes around 0.2 milliseconds per packet, which is already impressive but not enough comparing to other popular extration engines availbale on the market, given the fact that pcapkit is a comprehensive packet processing module.

Additionally, pcapkit introduced alternative extractionengines to accelerate this procedure. By now pcapkit supports Scapy, DPKT, and PyShark.

Test Environment

Operating System

macOS Ventura 13.4 Beta (22F5037d)

Chip

Apple M2 Pro

Memory

16 GB

Test Results

Engine

Performance (ms per packet)

dpkt

0.010694_027361

scapy

0.093399_399399

pcapkit

0.199796_296296

pyshark

25.066692_025359

Installation

Simply run the following to install the current version from PyPI:

pip install pypcapkit

Or install the latest version from the gi repository:

git clone https://github.com/JarryShaw/PyPCAPKit.git
cd pypcapkit
pip install -e .
# and to update at any time
git pull

And since pcapkit supports various extraction engines, and extensive plug-in functions, you may want to install the optional ones:

# for DPKT only
pip install pypcapkit[DPKT]
# for Scapy only
pip install pypcapkit[Scapy]
# for PyShark only
pip install pypcapkit[PyShark]
# and to install all the optional packages
pip install pypcapkit[all]
# or to do this explicitly
pip install pypcapkit dpkt scapy pyshark

For CLI usage, you will need to install the optional packages:

pip install pypcapkit[cli]
# or explicitly...
pip install pypcapkit emoji

Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pypcapkit-1.0.3.post3.tar.gz (652.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pypcapkit-1.0.3.post3-pp39-none-any.whl (956.3 kB view details)

Uploaded PyPy

pypcapkit-1.0.3.post3-pp38-none-any.whl (956.3 kB view details)

Uploaded PyPy

pypcapkit-1.0.3.post3-cp311-none-any.whl (956.3 kB view details)

Uploaded CPython 3.11

pypcapkit-1.0.3.post3-cp310-none-any.whl (956.3 kB view details)

Uploaded CPython 3.10

pypcapkit-1.0.3.post3-cp38-none-any.whl (956.3 kB view details)

Uploaded CPython 3.8

File details

Details for the file pypcapkit-1.0.3.post3.tar.gz.

File metadata

  • Download URL: pypcapkit-1.0.3.post3.tar.gz
  • Upload date:
  • Size: 652.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for pypcapkit-1.0.3.post3.tar.gz
Algorithm Hash digest
SHA256 1c445e766e51ca8699b23794b3d5d77f42ac45e9b4920e820e57e59d7bfc55a3
MD5 45f07af5b2a18ae6857d89067a1752ab
BLAKE2b-256 9f60def9453d61802816f45d0bc9ca5e6d0e8869e5225d22742288b5f0b5e6c4

See more details on using hashes here.

File details

Details for the file pypcapkit-1.0.3.post3-pp39-none-any.whl.

File metadata

File hashes

Hashes for pypcapkit-1.0.3.post3-pp39-none-any.whl
Algorithm Hash digest
SHA256 82171d677c607487c6fa7e7f58d6eba16a961b4bdae7b496793ec2ac6cd28bd6
MD5 30766b8cc5307e5b6793147751ff50b3
BLAKE2b-256 7be75a8399beb0596d8d5c98e265c50e61c1fb41176cab1302766b408f917a5c

See more details on using hashes here.

File details

Details for the file pypcapkit-1.0.3.post3-pp38-none-any.whl.

File metadata

File hashes

Hashes for pypcapkit-1.0.3.post3-pp38-none-any.whl
Algorithm Hash digest
SHA256 147b440bd6be72d674a02be310a0336c95475adfe2aa905026fe4fbe8612e930
MD5 5f40dec775cc4ab8dbaafbf761292339
BLAKE2b-256 2b9f6ee666f6dece5e65250296e1d5e8ae447ef8e6f2b5361d888c120b52d2c8

See more details on using hashes here.

File details

Details for the file pypcapkit-1.0.3.post3-cp311-none-any.whl.

File metadata

File hashes

Hashes for pypcapkit-1.0.3.post3-cp311-none-any.whl
Algorithm Hash digest
SHA256 00bf6717da22c8fc68026c346792b7f913e02f40121b0e11634edc4e598cbcf9
MD5 eac6b0672c3ff97f9daaee9350e131a2
BLAKE2b-256 60ab4f7736d03a3f361a0e4a44b69c7c09f1e7e09c9d7f332ae997937eb42463

See more details on using hashes here.

File details

Details for the file pypcapkit-1.0.3.post3-cp310-none-any.whl.

File metadata

File hashes

Hashes for pypcapkit-1.0.3.post3-cp310-none-any.whl
Algorithm Hash digest
SHA256 d055924a0c3f0b5cbdf93f6a3f16312915f7f97b9cb8c8c5aeaa07aca179781c
MD5 e8a28dfe8f765994b6721b0025dfdb3c
BLAKE2b-256 2c47a9d51b8f04165b009eab0f945ca1d55698ac9243ed92e11d7a7257c9fc8c

See more details on using hashes here.

File details

Details for the file pypcapkit-1.0.3.post3-cp38-none-any.whl.

File metadata

File hashes

Hashes for pypcapkit-1.0.3.post3-cp38-none-any.whl
Algorithm Hash digest
SHA256 12462386adb4c7bd3c3613159306de584554200e1e5bc05f350d71d8fa55e062
MD5 3368832c60c9f5112bf64d1904c3f1b6
BLAKE2b-256 81ccf9a31c7796d7b2730d340baa93532035f4849045b4d292fcea6c5a662db0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page