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.9.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

simplepcap-0.1.9-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: simplepcap-0.1.9.tar.gz
  • Upload date:
  • Size: 13.3 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.9.tar.gz
Algorithm Hash digest
SHA256 83bfe6233ed3865f21f343c6b4dba6f4c030d7500b918414ac54c90bc51b2c45
MD5 3a82453096ddfe60d9b47814e49b3d86
BLAKE2b-256 ba2d0bb23bd98a64f4b4e74375d594a904980b247b0840427527e7baa910cdb9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: simplepcap-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 12.7 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.9-py3-none-any.whl
Algorithm Hash digest
SHA256 a9b0dab9ebb8b36066797c454e9a0878eebb98082d87b6aad97e3286e1c1f91a
MD5 876f5ae71697d8fd1a3a6b801ea38da5
BLAKE2b-256 da0a394ed89d224db44c001830f52ebb1515e46fabdeaf554b96d5b12918f1d7

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