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. ๐ง