This script is a Python-based network packet sniffer with a graphical user interface (GUI) built using PyQt5. It captures and analyzes network packets in real-time, displaying relevant information such as source and destination IP addresses, protocols, and payload data for TCP and UDP packets. The script also logs packet information to a text file and saves captured packets to a PCAP file.
- GUI Interface: The application provides a user-friendly GUI for starting and stopping the packet sniffer, filtering packets by source IP and protocol, and displaying captured packet details.
- Packet Filtering: Users can filter packets by source IP address and protocol (TCP or UDP).
- Packet Logging: Captured packet information is logged to a text file (
packet_log.txt
). - Packet Capture: Captured packets are saved to a PCAP file (
captured_packets.pcap
). - Payload Display: The application attempts to decode and display the payload of TCP and UDP packets.
- Clone the Repository:
git clone https://github.com/zinzied/Packets-Analyzer-with-GUI.git
- Navigate to the Project Directory:
cd Packets-Analyzer-with-GUI
- Install the Required Dependencies:
pip install scapy PyQt5 Need To install Npcap for windows from here: https://npcap.com/dist/npcap-1.79.exe
- Run the Packet Sniffer Script:
sudo python Packets Analyser.py
- Source IP Filter: A text input for filtering packets by source IP address.
- Protocol Filter: A text input for filtering packets by protocol (6 for TCP, 17 for UDP).
- Start Sniffing Button: Starts the packet sniffing process.
- Stop Sniffing Button: Stops the packet sniffing process.
- Clear Packets Button: Clears the list of captured packets.
- Packet List: Displays a list of captured packets. Clicking on a packet shows its details in a new window.
- Initialization: The
PacketSnifferApp
class initializes the GUI and sets up the necessary components. - Start Sniffing: When the "Start Sniffing" button is clicked, a new
SnifferThread
is created and started. This thread captures packets using Scapy'ssniff
function. - Packet Callback: The
packet_callback
method processes each captured packet, applying the specified filters and displaying relevant information in the GUI. - Stop Sniffing: When the "Stop Sniffing" button is clicked, the sniffer thread is stopped.
- Clear Packets: The "Clear Packets" button clears the list of captured packets.
- Show Packet Details: Clicking on a packet in the list opens a new window displaying detailed information about the packet.
This script provides a comprehensive tool for network packet analysis with a focus on ease of use and real-time data display.