6181da7b42
CRITICAL FIXES: - Fixed pipe-to-sort deadlock in calculate_threat_scores() by separating loop output from sort - Fixed grep -E failure in stats section (returns 1 when no matches, breaking pipefail) - Fixed while-read loops with missing error handling (|| true needed for safety) - Fixed mapfile and array operations to handle empty results gracefully ROOT CAUSES: 1. Loop output piped to sort with background processes caused file descriptor issues → Solution: Output to temp file, wait for background jobs, then sort separately 2. Grep in pipeline without error handling fails when no matches found with set -eo pipefail → Solution: Add || true to allow empty results to be handled 3. Multiple while-read loops and mapfile operations didn't handle missing files → Solution: Added || true and defaults throughout RESULTS: ✅ Script now runs to completion without hanging or exiting early ✅ Full threat analysis report generated ✅ All sections complete: threat scoring, false positives, stats, fingerprinting, domain analysis ✅ Produces comprehensive bot analysis with attack vectors, DDoS sources, timing anomalies Testing: 180 IPs analyzed, 31 high-threat scores, full report generated with no errors