Pcap2CSV
is a Python utility for converting packet capture (PCAP) files into CSV format. This tool allows for easy analysis of network traffic by converting detailed packet data into a structured CSV file, which can be used for further analysis or reporting. π
- ποΈ Convert PCAP files to CSV format
- π Support for IP, TCP, UDP, and other protocols
- π₯οΈ Simple command-line interface
- π§ͺ Includes utility scripts for generating test PCAP files
- β Unit tests to ensure code reliability
-
Clone the Repository π
git clone https://github.com/mobiwn/Pcap2CSV.git cd Pcap2CSV
-
Set Up a Virtual Environment ποΈ
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Install Dependencies π¦
pip install -r requirements.txt
To convert a PCAP file to CSV, use the convert_pcap.py
script:
python scripts/convert_pcap.py <pcap_file> <csv_file>
Example:
python scripts/convert_pcap.py tests/data/test.pcap tests/data/test.csv
To generate a test PCAP file with random packets, use the generate_test_pcap.py
script:
python scripts/generate_test_pcap.py
This will generate a test.pcap
file in the tests/data/
directory.
Here is the structure of the Pcap2CSV
project as visible in GitHub:
Pcap2CSV/
βββ .gitignore
βββ LICENSE
βββ README.md
βββ requirements.txt
βββ pcap2csv/
β βββ __init__.py
β βββ converter.py
βββ scripts/
β βββ convert_pcap.py
β βββ generate_test_pcap.py
βββ tests/
βββ __init__.py
βββ __pycache__/
βββ data/
βββ test_converter.py
To run the unit tests, use the following command:
python -m unittest discover -s tests
Contributions are welcome! Please open an issue or submit a pull request to propose changes or improvements. π€
This project is licensed under the MIT License - see the LICENSE file for details. π
For any questions or support, please contact mobin.kh15@gmail.com. π§