Skip to main content

A simple pcap library for Python

Project description

Simple PCAP file parser

SimplePCAP. Logo Author: @mellin_venera
lint IC-IT License Python 3.10+ Documentation Status PyPI

Based on this and this PCAP Capture File Format description.

About

Simple PCAP was created to allow the user to focus as much as possible on processing packets stored in a pcap file without studying its structure. This is a very simple tool, it does not provide additional tools for analyzing packages. The library tries to provide the safest possible manipulation of pcap files.

Installation

From PyPI

pip install simplepcap

From GitHub

pip install git+https://github.com/ic-it/simplepcap.git

Usage example

Simple usage

from pprint import pprint
from simplepcap.parsers import DefaultParser


with DefaultParser(file_path="./pcaps/eth-1.pcap") as parser:
    pprint(parser.file_header)
    for packet in parser:
        pprint(packet)

Get all packets

from pprint import pprint
from simplepcap.parsers import DefaultParser


with DefaultParser(file_path="./pcaps/eth-1.pcap") as parser:
    packets = list(parser) # or packets = parser.get_all_packets()

pprint(packets)

Look at the examples folder for more examples.

Documentation

Look at the docs.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Project details


Download files

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

Source Distribution

simplepcap-0.1.8.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

simplepcap-0.1.8-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file simplepcap-0.1.8.tar.gz.

File metadata

  • Download URL: simplepcap-0.1.8.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.5

File hashes

Hashes for simplepcap-0.1.8.tar.gz
Algorithm Hash digest
SHA256 7d0fd8fa8ea3cdbf25ce0a482af0831befedb6f54cc7d688e1a2d1a5e68d526c
MD5 7404a6ae1bb9c1af318a044969a7591a
BLAKE2b-256 6f5ad7358f14b1c0861c1ff2806d6b621a707e4cb56e1dba2d728efda4fbad2f

See more details on using hashes here.

File details

Details for the file simplepcap-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: simplepcap-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 12.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.5

File hashes

Hashes for simplepcap-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 30e2f1068745b0b1596ae55f6e0ef48ac696573a1f6ec195439ba6151977efbe
MD5 d8728a92e2985b41ecf8fb0cd0eb5fd8
BLAKE2b-256 3503f4e94668e69c537239962528840c81f52944078cd3f2cf79e143a26a49b2

See more details on using hashes here.

Supported by

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