Fix remaining AWK-UNINIT issues in bot-analyzer and network analysis

modules/security/bot-analyzer.sh:
- Line 863: Initialize ip="" for rapid fire IP analysis
- Line 1564: Initialize variables in bot detection awk

modules/performance/network-bandwidth-analyzer.sh:
- Line 237: Initialize sum=0 for bandwidth calculation

modules/security/optimize-ct-limit.sh:
- Line 244: Initialize s=0 for request aggregation

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
cschantz
2026-02-07 02:50:34 -05:00
parent 2461d972ce
commit 69ee59e4be
3 changed files with 5 additions and 5 deletions
@@ -234,7 +234,7 @@ analyze_web_traffic() {
for logfile in "$log_dir"/*.log; do
[ -f "$logfile" ] || continue
local domain=$(basename "$logfile" .log)
local bytes=$(awk '{sum+=$10} END {print sum}' "$logfile" 2>/dev/null || echo "0")
local bytes=$(awk 'BEGIN {sum=0} {sum+=$10} END {print sum}' "$logfile" 2>/dev/null || echo "0")
if [ "$bytes" -gt 0 ]; then
local mb=$(awk "BEGIN {printf \"%.2f\", $bytes / 1048576}")