The Packet Sniffer Tool is a Python-based utility that captures and analyzes network packets. It extracts and displays relevant information such as source and destination IP addresses, protocols, and payload data. This tool is useful for network administrators and security professionals to monitor and troubleshoot network traffic.
- ๐ก Captures network packets in real-time.
- ๐๏ธ Displays source and destination IP addresses.
- ๐ Identifies protocols (TCP, UDP, ICMP, HTTP).
- ๐ Extracts and prints HTTP request details.
- ๐ฆ Shows payload data for deeper analysis.
- ๐ Python 3.x
- ๐ฆ
scapy
library - ๐ฅ๏ธ Npcap (for Windows users)
-
Install Python 3.x: If you don't have Python installed, download and install it from the official Python website.
-
Install Scapy: Install the
scapy
library using pip.pip install scapy
-
Install Npcap (Windows only): Download and install Npcap from the Npcap website. Ensure to select the option to install Npcap in "WinPcap API-compatible mode."
-
Clone or Download the Script: Save the script as
packet_sniffer.py
. -
Run the Script with Administrator Privileges:
- Open Command Prompt or Terminal with administrator privileges.
- Navigate to the directory where the script is located.
- Run the script using Python:
python packet_sniffer.py
-
Output: The script will start capturing packets and display the following information for each packet:
- IP Source and Destination addresses.
- Protocol type (TCP, UDP, ICMP).
- Source and Destination ports (for TCP/UDP).
- HTTP Method, Host, and Path (for HTTP packets).
- Payload data.
- RuntimeError: Sniffing and sending packets is not available at layer 2: Ensure Npcap is installed correctly in "WinPcap API-compatible mode."
- Permission Error: Run the script with administrator privileges to allow packet capture.
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! Please fork the repository and create a pull request with your changes.
For issues and inquiries, please open an issue on the GitHub repository or contact the author directly.