diff --git a/replit.md b/replit.md index 14c283f..4d33ca2 100644 --- a/replit.md +++ b/replit.md @@ -43,13 +43,25 @@ Sistema di rilevamento intrusioni per router MikroTik basato su Machine Learning ## Fix Recenti (Novembre 2025) -### ✅ Sistema Completamente Funzionante (17 Nov 2025) -- **Syslog Parser**: ✅ Funzionante, 670K+ log salvati -- **Database**: ✅ PostgreSQL con 670,503 log da router FIBRA +### ✅ Sistema Completamente Funzionante (17 Nov 2025 - 19:30) +- **Backend Python FastAPI**: ✅ Porta 8000, modello ML caricato, endpoint /stats funzionante +- **Database PostgreSQL**: ✅ 5 tabelle (network_logs, detections, routers, whitelist, training_history) +- **Syslog Parser**: ✅ Funzionante, log salvati continuamente - **Pattern Regex**: ✅ Match rate 99.9% su log MikroTik reali -- **DDoS Detection**: ✅ 305,424 eventi rilevati (45.6% traffico) +- **ML Detection**: ✅ Modello Isolation Forest addestrato, pronto per detection automatica - **Deployment**: ✅ Git workflow automatizzato con `push-gitlab.sh` e `update_from_git.sh --db` +### Backend FastAPI Fix (17 Nov 2025 - 19:30) +- **Problema**: Endpoint `/stats` falliva con errore 500 +- **Causa 1**: Colonna `logged_at` non esiste (nome corretto: `timestamp`) +- **Causa 2**: Tabella `routers` mancante +- **Causa 3**: Query non gestivano risultati `None` +- **Soluzione**: + - Corretto nome colonna da `logged_at` a `timestamp` in `/stats` + - Creato script SQL `database-schema/create_routers.sql` + - Aggiunta gestione `None` per tutte le query +- **Risultato**: Endpoint `/stats` funzionante, API completa operativa + ### Schema Database Fix (17 Nov 2025) - **Problema**: Tabella `network_logs` mancante, schema TypeScript disallineato con Python - **Soluzione**: Schema aggiornato con campi corretti (router_name, destination_ip/port, packet_length, raw_message) @@ -262,11 +274,16 @@ VALUES ('Router 1', '192.168.1.1', 'admin', 'password', 443, true); ## Preferenze Utente ### Operazioni Git e Deployment -- **IMPORTANTE**: Push su git tramite `./push-gitlab.sh` (NON comandi git manuali) -- Aggiornamenti server: `./update_from_git.sh` o `./update_from_git.sh --db` -- Workflow iterativo: - 1. Utente fornisce errori/modifiche dal server AlmaLinux +- **IMPORTANTE**: L'agente NON deve usare comandi git (push-gitlab.sh) perché Replit blocca le operazioni git +- **Workflow corretto**: + 1. Utente riporta errori/problemi dal server AlmaLinux 2. Agente risolve problemi e modifica file su Replit - 3. Utente esegue `./push-gitlab.sh` per commit+push - 4. Utente testa su server con `./update_from_git.sh` - 5. Ripeti fino a funzionamento completo + 3. **Utente esegue manualmente**: `./push-gitlab.sh` per commit+push + 4. **Utente esegue sul server**: `./update_from_git.sh` o `./update_from_git.sh --db` + 5. Utente testa e riporta risultati all'agente + 6. Ripeti fino a funzionamento completo + +### Linguaggio +- Tutte le risposte dell'agente devono essere in **italiano** +- Codice e documentazione tecnica: inglese +- Commit message: italiano