Metadata-Version: 2.1
Name: simplepcap
Version: 0.1.9
Summary: A simple pcap library for Python
Author-email: Illia Chaban <ic-it@mail.com>
License: MIT License
        
        Copyright (c) 2023 Illia Chaban
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://ic-it.github.io/simplepcap/
Project-URL: Documentation, https://ic-it.github.io/simplepcap/reference/
Project-URL: Bug Reports, https://github.com/ic-it/simplepcap/issues
Project-URL: Source Code, https://github.com/ic-it/simplepcap
Keywords: pcap,development,networking,python
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3 :: Only
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: black==23.9.1; extra == "dev"
Requires-Dist: flake8==6.1.0; extra == "dev"
Requires-Dist: Flake8-pyproject==1.2.3; extra == "dev"
Requires-Dist: flake8-function-order==0.0.5; extra == "dev"
Requires-Dist: mkdocs==1.5.2; extra == "dev"
Requires-Dist: mkdocstrings[python]==0.23.0; extra == "dev"
Requires-Dist: mkdocs-material==9.3.1; extra == "dev"
Requires-Dist: pytest==7.4.2; extra == "dev"
Provides-Extra: docs
Requires-Dist: mkdocs==1.5.2; extra == "docs"
Requires-Dist: mkdocstrings[python]==0.23.0; extra == "docs"
Requires-Dist: mkdocs-material==9.3.1; extra == "docs"
Provides-Extra: lint
Requires-Dist: flake8==6.1.0; extra == "lint"
Requires-Dist: Flake8-pyproject==1.2.3; extra == "lint"
Requires-Dist: flake8-function-order==0.0.5; extra == "lint"
Provides-Extra: test
Requires-Dist: pytest==7.4.2; extra == "test"
Provides-Extra: publish
Requires-Dist: build==1.0.3; extra == "publish"

# Simple PCAP file parser

![SimplePCAP. Logo Author: @mellin_venera](https://ic-it.github.io/simplepcap/assets/images/minilogo.png)  
[
    ![lint](https://img.shields.io/github/actions/workflow/status/ic-it/simplepcap/lint.yml)
](https://github.com/ic-it/simplepcap/actions)
[
    ![IC-IT](https://img.shields.io/badge/IC--IT-2023-blue)
](https://github.com/ic-it/)
[
    ![License](https://img.shields.io/github/license/ic-it/simplepcap)
](
    https://github.com/ic-it/simplepcap/blob/main/LICENSE
)
[
    ![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue)
](
    https://www.python.org/downloads/release/python-3100/
)
[
    ![Documentation Status](https://img.shields.io/badge/docs-latest-brightgreen.svg?style=flat)
](https://ic-it.github.io/simplepcap/)
[
    ![PyPI](https://img.shields.io/pypi/v/simplepcap)
](https://pypi.org/project/simplepcap/)

> Based on [this](https://www.ietf.org/archive/id/draft-gharris-opsawg-pcap-01.html) 
> and [this](https://wiki.wireshark.org/Development/LibpcapFileFormat#global-header) 
> 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
```bash
pip install simplepcap
```

### From GitHub
```bash
pip install git+https://github.com/ic-it/simplepcap.git
```

## Usage example
### Simple usage
```python
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
```python
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](./examples) folder for more examples.

## Documentation
Look at the [docs](https://ic-it.github.io/simplepcap/).


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