Skip to main content

Network utilities

Project description

Pyshark Plus Plus

pyshark-plus-plus is a Python library that provides a convenient interface for interacting with tshark, a command-line tool for capturing and analyzing network traffic. It enhances the capabilities of tshark by offering additional utilities, exception handling, and simplified methods for capturing network packets, listing interfaces, and analyzing .pcap files.

Features

  • Capture Network Traffic: Start and stop network packet captures with ease.
  • Interface Listing: List available network interfaces by number, name, or description.
  • PCAP Processing: Read, filter, and analyze .pcap files for network traffic data.
  • Statistics Extraction: Retrieve detailed traffic statistics from captured files.
  • Context Manager Support: Easily manage network capture sessions using Python's with statement.

Installation

  1. Clone the repository:

    git clone https://github.com/your-username/pyshark-plus-plus.git
    cd pyshark-plus-plus
    
  2. Install dependencies:

    pip install -r requirements.txt
    
  3. Ensure tshark is installed on your system. You can download it from Wireshark's website.

Getting Started

Basic Usage Example

from pyshark_plus_plus import TsharkWrapper

# Start a network capture on a specific interface
with TsharkWrapper(interface_number=1) as sniffer:
    print("Capturing traffic...")
    sniffer.start_capture(duration=10)  # Capture traffic for 10 seconds

Listing Available Interfaces

You can list the available interfaces using the following example:

from pyshark_plus_plus import TsharkWrapper

sniffer = TsharkWrapper()
print(sniffer.list_interfaces())

For more examples, check out the examples directory.

Project Structure

pyshark-plus-plus/
│
├── examples/
│   ├── __init__.py
│   ├── list_available_interfaces.py       # Example script for listing interfaces   └── sniff_from_localhost.py            # Example script for capturing packets from localhost
│
├── pyshark_plus_plus/
│   ├── __init__.py
│   ├── exceptions.py                      # Custom exceptions for the library   ├── pyshark_plus_plus.py               # Main wrapper class for interacting with tshark   └── statistics.py                      # Functions for processing capture statistics
│
├── tests/                                 # Unit tests for the library
│
├── venv/                                  # Virtual environment (optional)
│
├── LICENSE.txt                            # License information
├── CHANGELOG.md                           # Change history of the project
├── pyproject.toml                         # Configuration for building and packaging
├── README.md                              # Project documentation (this file)
└── tox.ini                                # Tox configuration for testing

Testing

Unit tests are available in the tests directory.

Contributing

We welcome contributions! Please follow these steps:

  • Fork the repository.
  • Create a new branch for your feature or bug fix.
  • Write tests for your changes.
  • Submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE.txt file for details.

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

pyshark_plus_plus-1.0.0rc1.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

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

pyshark_plus_plus-1.0.0rc1-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file pyshark_plus_plus-1.0.0rc1.tar.gz.

File metadata

  • Download URL: pyshark_plus_plus-1.0.0rc1.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.3

File hashes

Hashes for pyshark_plus_plus-1.0.0rc1.tar.gz
Algorithm Hash digest
SHA256 ff9aad46a7df2f3ae0f90e9429e86b3ad703288c101566afa459ac0d4deb0eb0
MD5 aabf9c97da5dcbf06d2cd6f7e6bad598
BLAKE2b-256 ce4f3f2436178a541759583f9cabd129f386a8f41eb4f663f7973e5b9116f509

See more details on using hashes here.

File details

Details for the file pyshark_plus_plus-1.0.0rc1-py3-none-any.whl.

File metadata

File hashes

Hashes for pyshark_plus_plus-1.0.0rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 ce1ec03d6a7b52c76a25a99f766120b01dc5ab165f29673aa4e4746206f3dd34
MD5 e5ed6fc14519a556cd87a8a89690728d
BLAKE2b-256 8046822d17197ce7903385e8b6cc05e380d30770290337f78d16906d256fa3b9

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