Adds new cron jobs and shell scripts for automated ML model training and anomaly detection, along with configurations for logging and system checks. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 7a657272-55ba-4a79-9a2e-f1ed9bc7a528 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 534244cd-b293-403e-a6d6-43cd9fbb30fb Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/449cf7c4-c97a-45ae-8234-e5c5b8d6a84f/7a657272-55ba-4a79-9a2e-f1ed9bc7a528/1P26v7M
27 lines
869 B
Bash
27 lines
869 B
Bash
#!/bin/bash
|
|
# =========================================================
|
|
# CRON DETECTION - Rilevamento anomalie automatico
|
|
# =========================================================
|
|
|
|
LOG_FILE="/var/log/ids/detect.log"
|
|
mkdir -p /var/log/ids
|
|
|
|
echo "=========================================" >> "$LOG_FILE"
|
|
echo "[$(date)] Detection automatica avviata" >> "$LOG_FILE"
|
|
echo "=========================================" >> "$LOG_FILE"
|
|
|
|
curl -X POST http://localhost:8000/detect \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"max_records": 50000, "hours_back": 1, "risk_threshold": 75, "auto_block": true}' \
|
|
--max-time 120 >> "$LOG_FILE" 2>&1
|
|
|
|
EXIT_CODE=$?
|
|
|
|
if [ $EXIT_CODE -eq 0 ]; then
|
|
echo "[$(date)] Detection completata con successo" >> "$LOG_FILE"
|
|
else
|
|
echo "[$(date)] Detection fallita (exit code: $EXIT_CODE)" >> "$LOG_FILE"
|
|
fi
|
|
|
|
echo "" >> "$LOG_FILE"
|