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
.pcapfiles for network traffic data. - Statistics Extraction: Retrieve detailed traffic statistics from captured files.
- Context Manager Support: Easily manage network capture sessions using Python's
withstatement.
Installation
-
Clone the repository:
git clone https://github.com/your-username/pyshark-plus-plus.git cd pyshark-plus-plus
-
Install dependencies:
pip install -r requirements.txt
-
Ensure
tsharkis 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
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyshark_plus_plus-1.0.0rc3.tar.gz.
File metadata
- Download URL: pyshark_plus_plus-1.0.0rc3.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b427a3f41349e7490dd57a72a7f1bd2b3b4360578cb46dea1f8edc2364b6c93c
|
|
| MD5 |
913a11af2500b4ca4bba83634c84c328
|
|
| BLAKE2b-256 |
e7f1bd1f8a6f744eadf7299ef095d093b3ae13eadf03b2ade2cb4d49fd7737a1
|
File details
Details for the file pyshark_plus_plus-1.0.0rc3-py3-none-any.whl.
File metadata
- Download URL: pyshark_plus_plus-1.0.0rc3-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c8ec4e0ea0418942db52a245ab621e2f527a2e59856c5a117c1ac9d6c1556ec
|
|
| MD5 |
6a76ba5258e3bb95d52c776b901317d5
|
|
| BLAKE2b-256 |
7edcee71a736b0e021a441cf126e5d5b05ed39b028ecf394fae74c9d862e6336
|