To build a Python-based network sniffer that captures and analyzes Ethernet, IP, and TCP traffic.
- Python
- socket module
- struct module
- Captures raw packets
- Extracts Ethernet, IP, and TCP headers
- Displays:
- Source & Destination MAC Addresses
- Source & Destination IP Addresses
- Protocol Type (TCP, UDP, ICMP)
- Source & Destination Ports (for TCP)
This script requires Linux and root access to capture packets.
sudo python3 network_sniffer.py