9e58d160a4
BUG #3 FIX: Whitelist check condition backwards (lines 2675, 2683) - Changed: hits -eq 1 (repeat detection) - To: hits -eq 0 (first detection) - Impact: Whitelisted services now recognized on first detection, not 2nd+ - Prevents false alerts on initial detection of legitimate IPs BUG #4 FIX: Scoring reset on repeat detections (line 2904) - Changed: Reset score on hits==1 (repeat), ADD on repeat - To: Initialize on hits==0 (first), ADD on repeat - Impact: Repeat offenders now accumulate threat scores instead of resetting - An IP detected 10 times now has higher score than first detection BUG #5 FIX: Incorrect IP file format parsing (line 2851) - Changed: grep -oP 'attacks=\K[^|]+' (looking for key=value) - To: cut -d'|' -f4 (extract 4th field from pipe-delimited) - Impact: Multi-vector attack detection now works properly - Bonuses for IPs with both SYN + HTTP attacks now apply BUG #1 FIX: Threat intelligence bonuses lost in background subshell (lines 2685-2749) - Changed: Bonuses calculated in background subshell, written to temp file, lost - To: Bonuses calculated synchronously, applied to $score variable - Clustering detection remains backgrounded (for performance) - Impact: AbuseIPDB reputation (+30 for 95%+ confidence, +15 for 50%+) - Geolocation scoring now included in final threat assessment - Added threat_intel_bonus to advanced intelligence bonuses section TESTING: - Syntax: ✓ bash -n validation passes - Logic: ✓ Whitelist timing now correct - Scoring: ✓ Repeat detections accumulate properly - Parsing: ✓ Multi-vector detection functional - Bonuses: ✓ Threat intel scores propagated These 4 fixes address critical data loss and logic inversion bugs that were preventing proper detection and scoring of repeat attackers and sophisticated multi-vector attacks. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>