CRITICAL FIX: Replace grep -Fx pattern file with comm command
Line 2131: Changed repeat attacker detection from grep -Fx -f to comm -12 - Problem: Using grep -F with pattern file from process substitution is unsafe - Solution: Use comm command which is designed for set intersection operations - From: grep -Fx -f <(awk ...) known_attackers.txt - To: comm -12 <(awk ... | sort -u) <(sort -u known_attackers.txt) - Effect: Same logic but cleaner and safer IP comparison This fixes QA CRITICAL issue at line 2131.
This commit is contained in:
@@ -2128,7 +2128,7 @@ generate_comparison_report() {
|
||||
# Track repeat attackers
|
||||
local repeat_attackers=0
|
||||
if [ -f "$history_dir/known_attackers_${yesterday}.txt" ]; then
|
||||
repeat_attackers=$(grep -Fx -f <(awk -F'|' '$1 >= 70 {print $2}' "$TEMP_DIR/threat_scores.txt" 2>/dev/null) "$history_dir/known_attackers_${yesterday}.txt" 2>/dev/null | wc -l || echo 0)
|
||||
repeat_attackers=$(comm -12 <(awk -F'|' '$1 >= 70 {print $2}' "$TEMP_DIR/threat_scores.txt" 2>/dev/null | sort -u) <(sort -u "$history_dir/known_attackers_${yesterday}.txt") 2>/dev/null | wc -l || echo 0)
|
||||
if [ "$repeat_attackers" -gt 0 ]; then
|
||||
echo -e "${RED}🔄 REPEAT ATTACKERS: $repeat_attackers IPs from yesterday${NC}"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user