Guardian-IDS is a sophisticated, modular Intrusion Detection System (IDS) designed specifically for IoT ecosystems (like Smart Home environments). It monitors network traffic in real-time, builds behavioral baselines for devices, and automatically mitigates threats such as DDoS attacks, port scanning, and lateral movement.
guardian-ids/
βββ main_guardian.py # Entry point - The IDS Control Console
βββ config/ # β¨ NEW: Configuration files (YAML/JSON)
β βββ settings.yaml # Thresholds, Whitelists, and OS settings
βββ analyzer/
β βββ traffic_profiler.py # Traffic profiling (Adaptive Baselines)
β βββ anomaly_detector.py # Detection algorithms (Threshold/Pattern)
β βββ threat_signatures.py # Malicious signature library
βββ core/
β βββ packet_sniffer.py # OS-Aware Scapy Sniffer
β βββ alert_manager.py # Alert levels & Notifications
β βββ logger.py # Standard & JSON Logging
βββ mitigation/
β βββ firewall_mimic.py # Firewall blocking simulation
β βββ device_quarantine.py # Device isolation workflow
βββ logs/ # JSON/Text Security Audit Logs
βββ docs/ # β¨ NEW: Documentation & Screenshots
βββ tests/
β βββ traffic_injector.py # Malicious traffic simulator
βββ requirements.txt
- Behavioral Whitelisting: Automatically learns the "Normal" behavior of IoT devices. (e.g., A Smart Bulb should only consume ~10KB/min and communicate with specific Cloud IPs).
- Threshold Monitoring: Detects sudden traffic spikes. If a lightbulb starts transmitting at 200Kbps, the system flags it as a potential DDoS node.
- Anti-Port Scanning: Detects if a compromised device is performing lateral movement scans against the Gateway or neighboring IoT devices.
- Protocol Anomaly Detection: Identifies traffic inconsistent with device types (e.g., A smart toaster initiating an SSH or Telnet request).
- Passive Triggered Scanning: Automatically initiates a deep port scan via a SecurityScanner when anomalous traffic is detected from a specific host.
- Dynamic Security Scoring: Combines traffic risk and vulnerability scan results to provide a real-time health score for every device.
- Network Quarantine: Once a device is deemed "Compromised," it is visually flagged on the dashboard and "virtually severed" from the network to prevent further infection.
- SOC Integration: Generates industry-standard JSON security logs, ready to be exported to any Security Operations Center (SOC) or SIEM (like ELK stack).
- Python 3.8+
- Root/Admin Privileges: Required for capturing raw packets (BPF/Raw Sockets).
pip install scapy cryptography pyyaml requests psutil
- Start the IDS Console:
sudo python main_guardian.py
- Launch a Simulated Attack (in a separate terminal):
sudo python -m tests.traffic_injector
Due to macOS kernel restrictions (BPF architecture), when monitoring the loopback interface (lo0), the BPF filter might drop packets with spoofed source IPs. For testing purposes, it is recommended to monitor the physical interface (en0) or use filter_str=None in the PacketSniffer configuration.
-
Linux (Ubuntu/Debian/CentOS):
- Interface: Use eth0, wlan0, or any.
- Loopback: lo.
- Performance: Best performance with filter="ip". Linux handles BPF filters natively and efficiently.
-
macOS (Darwin):
- Interface: Use en0 (Wi-Fi) or en1.
- Loopback: lo0.
- Constraint: Due to BSD-style encapsulation, filter="ip" may drop local loopback packets. Use filter_str=None if testing on lo0.
-
Windows:
- Requirement: Requires Npcap (installed in WinPcap API-compatible mode).
- Interface: Use conf.ifaces to find the GUID of your adapter.
Developed by Da-Wei Lin.