Add IP filtering and reorganize Website Management menu

IP Filtering enhancements to 500 error tracker:
- Filter localhost/internal IPs (127.x, 10.x, 172.16-31.x, 192.168.x)
- Detect cloud scanner IPs from AWS, GCP, Azure with user agent validation
- Skip known bot network IP ranges to reduce noise
- More aggressive filtering of non-relevant traffic

Website Management menu reorganization:
Reduced from 16 options to 7 logical categories:

Main menu now has:
1. Website Error Analyzer
2. Fast 500 Error Tracker
3. Debug Log Analyzer
4. Health & Maintenance → (5 tools: health check, DB optimizer, cache, plugin/theme audit)
5. WP-Cron Management → (3 tools: status, mass fix, system cron setup)
6. Mass Updates → (3 tools: core, plugins, themes updates)
7. Security & Compliance → (3 tools: malware scanner, permissions, login audit)

Benefits:
- Cleaner, more organized menu structure
- Related tools grouped together
- Easier navigation with logical subcategories
- Reduced cognitive load (7 vs 16 options)
This commit is contained in:
cschantz
2025-11-03 21:21:44 -05:00
parent 222dc08415
commit abdcb906d8
2 changed files with 163 additions and 33 deletions
+140 -30
View File
@@ -432,27 +432,18 @@ show_wordpress_menu() {
show_banner
echo -e "${BLUE}${BOLD}🌐 Website Management${NC}"
echo ""
echo -e "${BOLD}General Website Tools:${NC}"
echo -e "${BOLD}Error Analysis & Diagnostics:${NC}"
echo ""
echo -e " ${BLUE}1)${NC} 🔍 Website Error Analyzer - Find 500/config errors (filters bots)"
echo -e " ${RED}2)${NC} 🔥 Fast 500 Error Tracker - ONLY 500s + root cause diagnosis"
echo -e " ${BLUE}3)${NC} 📋 Debug Log Analyzer - Parse WP debug logs"
echo ""
echo -e "${BOLD}WordPress Tools:${NC}"
echo -e "${BOLD}WordPress Management:${NC}"
echo ""
echo -e " ${BLUE}3)${NC} Health Check (All Sites) - Scan all WP installations"
echo -e " ${BLUE}4)${NC} WP-Cron Status - Check cron job status"
echo -e " ${BLUE}5)${NC} WP-Cron Mass Fix - Fix/enable cron on all sites"
echo -e " ${BLUE}6)${NC} WP-Cron Mass Create - Setup proper system crons"
echo -e " ${BLUE}7)${NC} Plugin Audit - Security scan of plugins"
echo -e " ${BLUE}8)${NC} Theme Audit - Security scan of themes"
echo -e " ${BLUE}9)${NC} Database Optimizer - Clean/optimize WP databases"
echo -e " ${BLUE}10)${NC} Cache Clear (All Sites) - Clear all WP caches"
echo -e " ${BLUE}11)${NC} Mass Update Core - Update WordPress core (all)"
echo -e " ${BLUE}12)${NC} Mass Update Plugins - Update plugins (all sites)"
echo -e " ${BLUE}13)${NC} Login Security Audit - Check for weak passwords"
echo -e " ${BLUE}14)${NC} Malware Scanner - Scan for infected files"
echo -e " ${BLUE}15)${NC} Permission Fixer - Fix file permissions"
echo -e " ${BLUE}16)${NC} Debug Log Analyzer - Parse WP debug logs"
echo -e " ${BLUE}4)${NC} 🏥 Health & Maintenance → Audits, optimization, cleanup"
echo -e " ${BLUE}5)${NC} ⚙️ WP-Cron Management → Status, fixes, system cron setup"
echo -e " ${BLUE}6)${NC} 🔄 Mass Updates → Core, plugins, themes updates"
echo -e " ${BLUE}7)${NC} 🔒 Security & Compliance → Malware scan, permissions, login audit"
echo ""
echo -e " ${RED}0)${NC} Back to Main Menu"
echo ""
@@ -460,6 +451,68 @@ show_wordpress_menu() {
echo -n "Select option: "
}
# WordPress Health & Maintenance submenu
show_wp_health_menu() {
show_banner
echo -e "${BLUE}${BOLD}🏥 WordPress Health & Maintenance${NC}"
echo ""
echo -e " ${BLUE}1)${NC} Health Check (All Sites) - Scan all WP installations"
echo -e " ${BLUE}2)${NC} Database Optimizer - Clean/optimize WP databases"
echo -e " ${BLUE}3)${NC} Cache Clear (All Sites) - Clear all WP caches"
echo -e " ${BLUE}4)${NC} Plugin Audit - Security scan of plugins"
echo -e " ${BLUE}5)${NC} Theme Audit - Security scan of themes"
echo ""
echo -e " ${RED}0)${NC} Back to Website Management"
echo ""
echo -e "${CYAN}──────────────────────────────────────────────────────────────${NC}"
echo -n "Select option: "
}
# WP-Cron Management submenu
show_wp_cron_menu() {
show_banner
echo -e "${BLUE}${BOLD}⚙️ WP-Cron Management${NC}"
echo ""
echo -e " ${BLUE}1)${NC} WP-Cron Status - Check cron job status"
echo -e " ${BLUE}2)${NC} WP-Cron Mass Fix - Fix/enable cron on all sites"
echo -e " ${BLUE}3)${NC} WP-Cron Mass Create - Setup proper system crons"
echo ""
echo -e " ${RED}0)${NC} Back to Website Management"
echo ""
echo -e "${CYAN}──────────────────────────────────────────────────────────────${NC}"
echo -n "Select option: "
}
# Mass Updates submenu
show_wp_updates_menu() {
show_banner
echo -e "${BLUE}${BOLD}🔄 WordPress Mass Updates${NC}"
echo ""
echo -e " ${BLUE}1)${NC} Mass Update Core - Update WordPress core (all)"
echo -e " ${BLUE}2)${NC} Mass Update Plugins - Update plugins (all sites)"
echo -e " ${BLUE}3)${NC} Mass Update Themes - Update themes (all sites)"
echo ""
echo -e " ${RED}0)${NC} Back to Website Management"
echo ""
echo -e "${CYAN}──────────────────────────────────────────────────────────────${NC}"
echo -n "Select option: "
}
# Security & Compliance submenu
show_wp_security_menu() {
show_banner
echo -e "${BLUE}${BOLD}🔒 WordPress Security & Compliance${NC}"
echo ""
echo -e " ${BLUE}1)${NC} Malware Scanner - Scan for infected files"
echo -e " ${BLUE}2)${NC} Permission Fixer - Fix file permissions"
echo -e " ${BLUE}3)${NC} Login Security Audit - Check for weak passwords"
echo ""
echo -e " ${RED}0)${NC} Back to Website Management"
echo ""
echo -e "${CYAN}──────────────────────────────────────────────────────────────${NC}"
echo -n "Select option: "
}
# Performance & Diagnostics menu
show_performance_menu() {
show_banner
@@ -1150,20 +1203,77 @@ handle_wordpress_menu() {
case $choice in
1) run_module "website" "website-error-analyzer.sh" ;;
2) run_module "website" "500-error-tracker.sh" ;;
3) run_module "wordpress" "wp-health-check.sh" ;;
4) run_module "wordpress" "wp-cron-status.sh" ;;
5) run_module "wordpress" "wp-cron-mass-fix.sh" ;;
6) run_module "wordpress" "wp-cron-mass-create.sh" ;;
7) run_module "wordpress" "wp-plugin-audit.sh" ;;
8) run_module "wordpress" "wp-theme-audit.sh" ;;
9) run_module "wordpress" "wp-db-optimizer.sh" ;;
10) run_module "wordpress" "wp-cache-clear.sh" ;;
11) run_module "wordpress" "wp-mass-update-core.sh" ;;
12) run_module "wordpress" "wp-mass-update-plugins.sh" ;;
13) run_module "wordpress" "wp-login-security.sh" ;;
14) run_module "wordpress" "wp-malware-scanner.sh" ;;
15) run_module "wordpress" "wp-permission-fixer.sh" ;;
16) run_module "wordpress" "wp-debug-log-analyzer.sh" ;;
3) run_module "wordpress" "wp-debug-log-analyzer.sh" ;;
4) handle_wp_health_menu ;;
5) handle_wp_cron_menu ;;
6) handle_wp_updates_menu ;;
7) handle_wp_security_menu ;;
0) return ;;
*) echo -e "${RED}Invalid option${NC}"; sleep 1 ;;
esac
done
}
# WP Health & Maintenance submenu handler
handle_wp_health_menu() {
while true; do
show_wp_health_menu
read -r choice
case $choice in
1) run_module "wordpress" "wp-health-check.sh" ;;
2) run_module "wordpress" "wp-db-optimizer.sh" ;;
3) run_module "wordpress" "wp-cache-clear.sh" ;;
4) run_module "wordpress" "wp-plugin-audit.sh" ;;
5) run_module "wordpress" "wp-theme-audit.sh" ;;
0) return ;;
*) echo -e "${RED}Invalid option${NC}"; sleep 1 ;;
esac
done
}
# WP-Cron Management submenu handler
handle_wp_cron_menu() {
while true; do
show_wp_cron_menu
read -r choice
case $choice in
1) run_module "wordpress" "wp-cron-status.sh" ;;
2) run_module "wordpress" "wp-cron-mass-fix.sh" ;;
3) run_module "wordpress" "wp-cron-mass-create.sh" ;;
0) return ;;
*) echo -e "${RED}Invalid option${NC}"; sleep 1 ;;
esac
done
}
# Mass Updates submenu handler
handle_wp_updates_menu() {
while true; do
show_wp_updates_menu
read -r choice
case $choice in
1) run_module "wordpress" "wp-mass-update-core.sh" ;;
2) run_module "wordpress" "wp-mass-update-plugins.sh" ;;
3) run_module "wordpress" "wp-mass-update-themes.sh" ;;
0) return ;;
*) echo -e "${RED}Invalid option${NC}"; sleep 1 ;;
esac
done
}
# Security & Compliance submenu handler
handle_wp_security_menu() {
while true; do
show_wp_security_menu
read -r choice
case $choice in
1) run_module "wordpress" "wp-malware-scanner.sh" ;;
2) run_module "wordpress" "wp-permission-fixer.sh" ;;
3) run_module "wordpress" "wp-login-security.sh" ;;
0) return ;;
*) echo -e "${RED}Invalid option${NC}"; sleep 1 ;;
esac
+23 -3
View File
@@ -92,6 +92,29 @@ while IFS= read -r log; do
fi
fi
# Parse log line to get IP first
read -r ip _ _ timestamp _ request _ _ <<< "$line"
# IP-based filtering - skip non-relevant IPs
# Skip localhost/internal IPs
if [[ "$ip" =~ ^(127\.|::1|10\.|172\.(1[6-9]|2[0-9]|3[01])\.|192\.168\.) ]]; then
((filtered_bots++))
continue
fi
# Skip common cloud scanner IPs and known bot networks
# AWS, GCP, Azure scanner ranges, security scanners
if [[ "$ip" =~ ^(3\.|13\.|18\.|34\.|35\.|52\.|54\.) ]] || \
[[ "$ip" =~ ^(104\.196\.|104\.154\.|130\.211\.|35\.184\.|35\.185\.|35\.186\.|35\.187\.|35\.188\.|35\.189\.|35\.19) ]] || \
[[ "$ip" =~ ^(20\.|40\.|51\.|52\.|13\.64\.|13\.65\.|13\.66\.|13\.67\.|13\.68\.) ]]; then
# Check if it's actually a bot by examining user agent
line_lower="${line,,}"
if [[ "$line_lower" =~ (bot|crawler|spider|scanner|monitor|cloud|amazon|google|microsoft|azure) ]]; then
((filtered_bots++))
continue
fi
fi
# Bot/Scanner filtering - skip noise
line_lower="${line,,}"
if [[ "$line_lower" =~ (bot|crawler|spider|scraper|scanner|check|monitor|uptime|pingdom|newrelic|datadog|nagios|zabbix|prtg|gomez|keynote|catchpoint|dotcom-monitor|site24x7|uptimerobot|statuscake|nodequery|hetrixtools|freshping|uptrendscom|siteuptime|montastic|updown\.io|apex|alertsite|webmon|wormly) ]]; then
@@ -106,9 +129,6 @@ while IFS= read -r log; do
((filtered_bots++))
continue
fi
# Parse log line
read -r ip _ _ timestamp _ request _ _ <<< "$line"
# Extract URL
if [[ "$request" =~ '"'[A-Z]+[[:space:]]([^[:space:]]+) ]]; then