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

This version

1.0.2

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.2.tar.gz (436.4 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.2-cp311-none-any.whl (733.6 kB view details)

Uploaded CPython 3.11

pypcapkit-1.0.2-cp310-none-any.whl (733.6 kB view details)

Uploaded CPython 3.10

pypcapkit-1.0.2-cp39-none-any.whl (733.6 kB view details)

Uploaded CPython 3.9

pypcapkit-1.0.2-cp38-none-any.whl (733.6 kB view details)

Uploaded CPython 3.8

File details

Details for the file pypcapkit-1.0.2.tar.gz.

File metadata

  • Download URL: pypcapkit-1.0.2.tar.gz
  • Upload date:
  • Size: 436.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for pypcapkit-1.0.2.tar.gz
Algorithm Hash digest
SHA256 a58cff6d04de9d674faa1e6d5568d73ce264cad522780795504453e55597a23f
MD5 5fc2ece17eba4878f5f7db30267ff927
BLAKE2b-256 17201f9694e424136f9498c51215d3dcde48a47b09125cef034bbe839e963156

See more details on using hashes here.

File details

Details for the file pypcapkit-1.0.2-cp311-none-any.whl.

File metadata

  • Download URL: pypcapkit-1.0.2-cp311-none-any.whl
  • Upload date:
  • Size: 733.6 kB
  • Tags: CPython 3.11
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for pypcapkit-1.0.2-cp311-none-any.whl
Algorithm Hash digest
SHA256 6e44e13578d22eecf5d74972d9ec8dc66b96c45f7f13dec90dfe8411a042d68b
MD5 a92abfb5e78ba29890499e8186732ee3
BLAKE2b-256 3b8c2797e4887ac59e89ade42dd752076d700bf7c12cd966140f258abd307ca6

See more details on using hashes here.

File details

Details for the file pypcapkit-1.0.2-cp310-none-any.whl.

File metadata

  • Download URL: pypcapkit-1.0.2-cp310-none-any.whl
  • Upload date:
  • Size: 733.6 kB
  • Tags: CPython 3.10
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for pypcapkit-1.0.2-cp310-none-any.whl
Algorithm Hash digest
SHA256 45b3205542fed793645b57f9e3e3e07b5ddb45c583b307640c2e1e21118314b6
MD5 08748da29f56afb0cfd8c22c78168b93
BLAKE2b-256 6488239b651e2a51a9a90f3be3e75008f67767799d3e49fe3ac12a79077150b6

See more details on using hashes here.

File details

Details for the file pypcapkit-1.0.2-cp39-none-any.whl.

File metadata

  • Download URL: pypcapkit-1.0.2-cp39-none-any.whl
  • Upload date:
  • Size: 733.6 kB
  • Tags: CPython 3.9
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for pypcapkit-1.0.2-cp39-none-any.whl
Algorithm Hash digest
SHA256 d27818a91b73786efd4633ccd9bb65b1dad7a0b201ff035356d29c98fc05213a
MD5 c427a65050f564487925b54d86bba82c
BLAKE2b-256 09ec96cc5958297e263c10ff4b791fb1740c15ed5d414155ad07bd8998d00e2c

See more details on using hashes here.

File details

Details for the file pypcapkit-1.0.2-cp38-none-any.whl.

File metadata

  • Download URL: pypcapkit-1.0.2-cp38-none-any.whl
  • Upload date:
  • Size: 733.6 kB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for pypcapkit-1.0.2-cp38-none-any.whl
Algorithm Hash digest
SHA256 0ee78ec7c55863e8e1efa2a223a22c0e195eba25511f3bd2e4fcd5eeafaabf05
MD5 b95899704293a8fd40b24d5c7d1e75ac
BLAKE2b-256 7cf173eb25dc50384e29b772624946e904de5c7f13b19b24789c86bf31151a6f

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