Prerequisites
Before starting, confirm the following:- All Python dependencies installed (see Installation)
- Npcap is installed and active on Windows
- The five model
.pklfiles are present in the project root - You are running the terminal as Administrator (required for IPS blocking)
Launch and monitor
Start the GUI
Launch the main dashboard from the project root:The PyQt5 window opens with several tabs: the main events table, a live traffic panel, SOC metrics, charts, and the IPS response panel.
Select your network interface and start monitoring
In the dashboard toolbar, find the interface dropdown (a
QComboBox listing your available network adapters, e.g. Ethernet, Wi-Fi).Select your active interface and click Iniciar Monitoreo.The status bar at the bottom will confirm the sniffer is active. The AsyncSniffer from Scapy starts capturing all IP traffic on the selected interface in a background thread.If you leave the dropdown on the default selection, Scapy uses the system’s default interface (
conf.iface). Explicitly selecting your interface is recommended to avoid capturing on a wrong adapter.Observe live traffic and detected events
Two panels update in real time:
Each attack type is color-coded in the table for quick visual triage.
- Tráfico en Vivo — Shows a rolling summary of every captured packet (e.g.
Ether / IP / TCP 192.168.1.5:54321 > 10.0.0.1:80 S). Limited to the last 500 lines. - Events table — Shows only detected intrusions, with columns for timestamp, source IP, destination IP, port, protocol, flag, and attack type.
| Example label | Meaning |
|---|---|
SYN Flood (ML: 98.4%) | ML classified with high confidence |
Escaneo de Puertos (Heurística) | Heuristic rule triggered; ML confidence below 70% |
Posible Exploit (ML: 73.2%) | ML-confirmed exploit attempt |
Enable IPS mode
Toggle the IPS checkbox in the dashboard toolbar to activate automatic IP blocking.When IPS mode is active:
- Attacks classified with ML confidence ≥ 70% trigger a real firewall block.
- Attacks detected by heuristic rules (critical severity: Exploit, SYN Flood, DDoS) are blocked immediately, regardless of ML confidence.
- Each blocked IP appears in the IPS panel with a 60-second countdown timer. The row turns “Expirado” automatically when the block expires.
- A Telegram alert is sent asynchronously for every detected event (requires Telegram configuration).
Test detection with the attack simulator
In a separate terminal (also run as Administrator), launch the attack simulator:At the prompt, choose option 1 (Port Scan) for the fastest visible detection:The simulator sends 999 TCP SYN packets to sequential ports from a spoofed source IP (
192.168.100.5) using Layer 2 (sendp), ensuring the packets are visible to the Windows Npcap driver.Within seconds you should see the event Escaneo de Puertos (Heurística) or Escaneo de Puertos (ML: XX%) appear in the events table. If IPS mode is enabled, the spoofed IP is blocked and appears in the IPS panel.The simulator uses IP spoofing (random or fixed fake source IPs) on each run. This prevents the IDS from silently skipping events because the same IP was already blocked from a previous test run.
Programmatic usage
You can control the IDS engine directly from Python without the GUI by importingids.py:
The
ComunicadorIDS signals (nuevo_evento, nuevo_bloqueo, nuevo_trafico) are PyQt5 pyqtSignal objects. To consume them outside a Qt application you need a running QApplication event loop, or you can read from ids.eventos_detectados (a deque) directly after capture.What to expect
After a successful Port Scan test:- The events table shows one or more rows with
Escaneo de Puertos. - If IPS is enabled, the IPS panel shows the spoofed IP (
192.168.100.5) with a 60-second countdown. - A Telegram message is dispatched (if configured) with the source IP, protocol, and port.
- The event is persisted to
intrusiones.db(SQLite) and appended to the CSV dataset for future model retraining.