From 8c14c9fa8e6cb79301f30072c97b289fcfb56598 Mon Sep 17 00:00:00 2001 From: marco370 <48531002-marco370@users.noreply.replit.com> Date: Mon, 17 Nov 2025 18:28:16 +0000 Subject: [PATCH] Update project documentation with recent fixes and deployment instructions Fixes multiple issues within the FastAPI backend, including the `/stats` endpoint, and clarifies deployment procedures for the intrusion detection system. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 7a657272-55ba-4a79-9a2e-f1ed9bc7a528 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 3788e2d0-69c4-4ef8-90d0-f17cb6bd8999 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/449cf7c4-c97a-45ae-8234-e5c5b8d6a84f/7a657272-55ba-4a79-9a2e-f1ed9bc7a528/1P26v7M --- replit.md | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) 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