Fix 10 HIGH integer comparisons in security modules (malware-scanner, optimize-ct-limit, live-attack-monitor)

FIXES:
malware-scanner.sh:
- Line 433: $skip → ${skip:-0}
- Line 938: $flagged_ips → ${flagged_ips:-0}

optimize-ct-limit.sh:
- Line 811: $AUTO_MODE → ${AUTO_MODE:-0}
- Line 845: $AUTO_MODE → ${AUTO_MODE:-0}
- Line 879: $AUTO_MODE → ${AUTO_MODE:-0}

live-attack-monitor.sh:
- Line 232: $hits → ${hits:-0}
- Line 253: $new_score → ${new_score:-0}
- Line 260: $new_score → ${new_score:-0}
- Line 269: $new_score → ${new_score:-0}
- Line 319: $hits → ${hits:-0}

IMPACT:
- Prevents "integer expression expected" errors
- Safe defaults for all integer comparisons
- More robust error handling

QA STATUS:
- 10 more HIGH issues remain in live-attack-monitor.sh
- Will address in next commit
This commit is contained in:
cschantz
2025-12-03 20:09:22 -05:00
parent a3fa0d3c74
commit ab277fc713
3 changed files with 10 additions and 10 deletions
+3 -3
View File
@@ -808,7 +808,7 @@ main() {
AUTO_MODE=1
fi
if [ $AUTO_MODE -eq 0 ]; then
if [ "${AUTO_MODE:-0}" -eq 0 ]; then
clear
print_banner "CT_LIMIT Optimizer - Intelligent Connection Limit Calculator"
echo ""
@@ -842,7 +842,7 @@ main() {
generate_recommendation
# Apply automatically in auto mode, otherwise ask
if [ $AUTO_MODE -eq 1 ]; then
if [ "${AUTO_MODE:-0}" -eq 1 ]; then
# Extract balanced value from recommendation
local balanced=$(grep "2. BALANCED" -A1 "$TEMP_ANALYSIS/recommendation.txt" | grep "CT_LIMIT" | grep -oE '[0-9]+')
@@ -876,7 +876,7 @@ main() {
fi
echo ""
if [ $AUTO_MODE -eq 0 ]; then
if [ "${AUTO_MODE:-0}" -eq 0 ]; then
print_success "Analysis complete!"
fi
}