This was a fast project aimed at learning more about network-based Intrusion Detection Systems (IDS) built in Python.
The project monitors incoming TCP connections and detects suspicious activity such as brute-force attacks and port scanning using threshold-based anomaly detection.
- Multithreaded TCP server
- Real-time connection monitoring
- Brute-force detection (sliding time window)
- Port scan detection
- Alert cooldown system (prevents alert spam)
- Structured logging to file
- IPv4 and IPv6 support
The project uses a threshold-based anomaly detection model:
If an IP address exceeds a defined number of connections within a time window:
→ An alert is triggered.
If an IP contacts multiple unique ports
→ An alert is triggered.
To prevent alert flooding, a cooldown mechanism limits repeated alerts from the same IP.
- Python 3.10+
bash python main.py
for i in {1..10}; do nc localhost 9999; done
for ($i=0; $i -lt 10; $i++) { Test-NetConnection localhost -Port 9999 }