Packet-Analyzer is a Python-based network packet analyzer that leverages the Scapy library to capture and analyze live network traffic. It provides real-time insights into network protocols such as IP, TCP, UDP, ICMP, HTTP, and DNS. This project is intended for educational and controlled lab environments. Unauthorized packet capturing on networks without permission may be illegal.
- Live packet capture on specified network interfaces
- Protocol analysis for:
- IPv4 & IPv6
- TCP, UDP, ICMP
- HTTP requests and responses
- DNS queries and responses
- BPF (Berkeley Packet Filter) support (e.g.,
tcp port 80) - Optional logging of captured packets to a file
- Display source/destination IPs, ports, timestamps, and protocol information
- Python 3.8 or higher
- Linux or WSL recommended for full packet capture functionality
- Root privileges to capture packets on network interfaces
- Git
- Clone the repository
git clone git@github.com:siddharthseth888/Packet-Analyzer.git
cd Packet-Analyzer- Set up a Python virtual environment
python3 -m venv .venv- Activate the virtual environment
For Linux and MacOS
source .venv/bin/activateFor Windows(Powershell)
.venv\Scripts\Activate- Upgrade pip and install dependencies
pip install --upgrade pip
pip install scapy- Verify Installation
python3 -c "from scapy.all import *; print('Scapy installed successfully!')"If no errors are shown, you are ready to run the analyzer.
Running the Main Script
python3 packet_analyzer.py# Basic usage
sudo python3 packet_analyzer.py -i eth0
# With a filter (only TCP 80 traffic)
sudo python3 packet_analyzer.py -i eth0 -f "tcp port 80"
# Capture only 100 packets
sudo python3 packet_analyzer.py -i eth0 -c 100
# Save output to log file
sudo python3 packet_analyzer.py -i eth0 -l output.logThanks For Reading! Keep coding!