A comprehensive network intrusion detection system with a graphical user interface built using Python, Flet, and Scapy. This system monitors network traffic in real-time and detects various types of suspicious activities and potential security threats.
- Live packet capture from network interfaces
- PCAP file analysis support
- Flow-based traffic analysis using 5-tuple identification (source IP, destination IP, source port, destination port, protocol)
- ICMP Tunneling Detection: Identifies suspicious ICMP traffic patterns
- DNS Tunneling Detection: Detects potential data exfiltration through DNS queries
- HTTP without DNS: Flags HTTP requests without prior DNS resolution
- Protocol-Port Mismatch: Identifies traffic using incorrect ports for protocols
- Blacklisted Entities: Monitors for blacklisted IPs, ports, and protocols
- Oversized Packets: Detects abnormally large packets (>6000 bytes)
- High-volume Flows: Identifies flows exceeding data thresholds
- Dark/Light theme toggle
- Network interface selection
- Advanced filtering options (IP addresses, ports, protocols, direction)
- Real-time flow visualization
- Suspicious activity alerts
- PCAP file upload and analysis
The system consists of several key components:
gui.py
: Main GUI application built with Fletpacket_handler.py
: Core packet processing and flow managementrulebook.py
: Detection rules and suspicious activity analysistest_rulebook.py
: Unit tests for detection capabilities
- Docker and Docker Compose
- Linux environment (recommended)
- For Windows: X Server (VcXsrv) for GUI display
- Clone the repository:
git clone <repository-url>
cd intrusion-detection-system
- Build and run the Docker containers:
cd /dock
sudo docker-compose build
sudo docker-compose up
-
Download and install VcXsrv Windows X Server
-
Configure XLaunch:
- Select "Full Screen" option
- Select "Start no client" option
- Mark "Disable access control" box
- Click Finish
-
Set environment variables:
export DISPLAY=$(ip route list default | awk '{print $3}'):0
export LIBGL_ALWAYS_INDIRECT=1
- Build and run:
sudo docker-compose build
sudo docker-compose up
- Launch the application
- Select a network interface from the dropdown menu
- Click "Start Sniffing" to begin real-time packet capture
- Monitor the flow list and alerts for suspicious activities
- Click "Pick files" to upload a PCAP file
- Select a
.pcap
or.pcapng
file - The system will automatically analyze all packets and display results
Use the filter controls to focus on specific traffic:
- Source/Destination IP: Filter by specific IP addresses
- Source/Destination Port: Filter by port numbers
- Protocol: Filter by network protocol
- Direction: Filter by traffic direction (incoming/outgoing)
- Detects ICMP packets with payloads >64 bytes
- Monitors for excessive ICMP requests (>20 to same destination)
- Identifies domains with excessive queries (>15)
- Detects suspiciously long subdomains (>30 characters)
Ports: 1337, 1234, 2345, 3456, 4567, 5678, 6789, 7890, 8901, 9012, 6969
Protocols: NBNS, ARP, LLMNR (local protocols)
IPs: Loopback, broadcast, and specific threat IPs
Ensures traffic uses appropriate ports for protocols based on standard port assignments.
Run the test suite to verify detection capabilities:
python -m pytest volumes/test_rulebook.py -v
Tests cover:
- ICMP tunneling detection
- Blacklisted entity detection
- DNS tunneling identification
- Protocol-port mismatch validation
- Packet size validation
- Flet: Modern GUI framework for Python
- Scapy: Powerful packet manipulation library
- Docker: Containerization platform
The system uses several configuration files:
docker-compose.yml
: Container orchestrationflet-dock/Dockerfile
: Application container setuprequirements.txt
: Python dependencies.gitignore
: Version control exclusions
- Requires elevated privileges for packet capture
- Runs in privileged Docker container for network access
- Designed for authorized network monitoring only
- Ensure compliance with local network monitoring policies
- Fork the repository
- Create a feature branch
- Add tests for new detection rules
- Submit a pull request
This project is provided for educational and authorized security monitoring purposes. Ensure compliance with applicable laws and regulations when deploying in production environments.
GUI not displaying on Windows: Ensure X Server is running and DISPLAY variable is set correctly
Permission denied errors: Verify Docker is running with appropriate privileges
Network interface not found: Check available interfaces with ip link show
or similar commands
Container build failures: Ensure Docker has sufficient resources and internet connectivity
For issues and questions, please check the project documentation or submit an issue in the repository.