Metadata-Version: 2.1
Name: pypcaptools
Version: 1.2
Summary: 一个用于解析pcap文件的python库
Home-page: https://github.com/ZGC-BUPT-aimafan/split_flow.git
Author: ZGC-BUPT-aimafan
Author-email: chongrufan@nuaa.edu.cn
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: dpkt==1.9.8
Requires-Dist: scapy==2.6.0

# pypcaptools介绍

pypcaptools 是一个用于处理pcap文件的 Python 库，可以实现以下功能：
1. 将流量按照session进行分隔，可以输出pcap格式或json格式。

## 安装

```bash
pip install pypcaptools
```

## Quick Start

```python
from pypcaptools import PcapHandler

origin_pcap = "/path/dir/filename"

ph = PcapHandler(origin_pcap)
output_dir = "/path/dir/output_dir"

# 分流之后以pcap格式输出，TCP流允许从中途开始（即没有握手过程）
ph.split_flow(output_dir, tcp_from_first_packet=False, output_type="pcap")

# 分流之后以json格式输出，输出一个json文件，其中每一个单元表示一条流，TCP流必须从握手阶段开始，从中途开始的TCP流会被丢弃
ph.split_flow(output_dir, tcp_from_first_packet=True, output_type="json")
```
