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

Chip

Apple M2 Pro

Memory

16 GB

Test Results

Engine

Performance (ms per packet)

dpkt

0.010390_056723

scapy

0.091690_233567

pcapkit

0.200390_390390

pyshark

24.682185_018351

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.1.0.post2.tar.gz (655.1 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.1.0.post2-pp39-none-any.whl (958.7 kB view details)

Uploaded PyPy

pypcapkit-1.1.0.post2-pp38-none-any.whl (958.7 kB view details)

Uploaded PyPy

pypcapkit-1.1.0.post2-cp310-none-any.whl (958.7 kB view details)

Uploaded CPython 3.10

pypcapkit-1.1.0.post2-cp39-none-any.whl (958.7 kB view details)

Uploaded CPython 3.9

pypcapkit-1.1.0.post2-cp38-none-any.whl (958.7 kB view details)

Uploaded CPython 3.8

File details

Details for the file pypcapkit-1.1.0.post2.tar.gz.

File metadata

  • Download URL: pypcapkit-1.1.0.post2.tar.gz
  • Upload date:
  • Size: 655.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for pypcapkit-1.1.0.post2.tar.gz
Algorithm Hash digest
SHA256 a4eb3e8491457eb7d1cde5f97417e4b612cb106b716373eaa94e7cd3a23e74fe
MD5 9fe9bf275cc60c72e87b852b5549a3e8
BLAKE2b-256 c446e012d20f741b9bea274036e46ee9991afa7b48583fd90197d35115a506b1

See more details on using hashes here.

File details

Details for the file pypcapkit-1.1.0.post2-pp39-none-any.whl.

File metadata

File hashes

Hashes for pypcapkit-1.1.0.post2-pp39-none-any.whl
Algorithm Hash digest
SHA256 9e958a3653273142a510cd58507dd49d67a9aa246e3239af33f8efe661d139ad
MD5 7f39108de4fb976fec5f08ba9a825a41
BLAKE2b-256 f3ac29b9f45d553ede8d3d9b16afdf091b68cfed42f1a60e5d029ec816fff3fb

See more details on using hashes here.

File details

Details for the file pypcapkit-1.1.0.post2-pp38-none-any.whl.

File metadata

File hashes

Hashes for pypcapkit-1.1.0.post2-pp38-none-any.whl
Algorithm Hash digest
SHA256 0ccef6911442660c0fcc7b88b15da72fd48827c34d24ed2780401838055ac098
MD5 30dec78304be8d0bb334562541f99aeb
BLAKE2b-256 29ea6ed6bb4b5c411eab7bb223edd8a1029e49e32f8cc190f08e867d1be6d834

See more details on using hashes here.

File details

Details for the file pypcapkit-1.1.0.post2-cp310-none-any.whl.

File metadata

File hashes

Hashes for pypcapkit-1.1.0.post2-cp310-none-any.whl
Algorithm Hash digest
SHA256 535527f456beae522bb25aff3588bd79c36911e2943af0d5e7dcfc569f6be40a
MD5 53b341117fa6ae076f4b2193c4478403
BLAKE2b-256 22fc49302c324dd7f590c52ba47cf48ae27a0e5b94ef0534b4892150cc14fe4f

See more details on using hashes here.

File details

Details for the file pypcapkit-1.1.0.post2-cp39-none-any.whl.

File metadata

File hashes

Hashes for pypcapkit-1.1.0.post2-cp39-none-any.whl
Algorithm Hash digest
SHA256 7d8d9ac6b1b1526e792c44b8bdcfc1801d08eb7749e0a16c878c4e1ee46c73bb
MD5 9a69a8f8dab6a9f4f172ba2e7a18ee6e
BLAKE2b-256 184e8bf2bfdb8ed560e67a8be1ff952cd4c3fd9ebf9368c3803f5e98e8c5bd76

See more details on using hashes here.

File details

Details for the file pypcapkit-1.1.0.post2-cp38-none-any.whl.

File metadata

File hashes

Hashes for pypcapkit-1.1.0.post2-cp38-none-any.whl
Algorithm Hash digest
SHA256 1123b9180cdf0c87f87a0cf5b1091257f62bc1155ce2a1987039d1d1204c3507
MD5 4e19a79bd307201915ba96f2711ce2fb
BLAKE2b-256 0819c4a93ee4c78ce85cf988bc0dcba0add6d0118712bf26726b22f0d22e9d2b

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