CRITICAL: Apply all bug fixes to production branch

This commit applies the critical fixes found during beta testing:

1. FIX: Show installation guide instead of exiting when no scanners detected
   - Heredoc was exiting with code 1 instead of showing helpful installation instructions
   - Changed to display full installation guide and exit gracefully with code 0
   - Users now see 'here's how to install' instead of just error

2. FIX: Add missing color variable definitions to generator
   - Generator script was using CYAN, RED, YELLOW, GREEN, NC colors
   - But these variables were never defined in the generator itself
   - Added color variable definitions at script start
   - Menu now displays with proper colors

3. FIX: Add print_banner to required functions validation
   - show_scan_menu() calls print_banner but it wasn't validated
   - If common-functions.sh failed to source, menu would crash
   - Added print_banner to validate_required_functions()

All fixes ensure the malware scanner menu displays properly even with no
scanners installed, and provides helpful guidance for installation.
This commit is contained in:
cschantz
2026-03-21 01:11:04 -04:00
parent aa432a08bd
commit 9942296714
+52 -2
View File
@@ -8,6 +8,14 @@
# Scan scope: Single domain, user account, or entire server
################################################################################
# Color definitions (matching launcher.sh)
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
CYAN='\033[0;36m'
BOLD='\033[1m'
NC='\033[0m'
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
# Source required libraries (warn if missing, but allow graceful degradation)
@@ -32,6 +40,7 @@ validate_required_functions() {
local required_functions=(
"confirm"
"print_header"
"print_banner"
"select_user_interactive"
"get_user_domains"
)
@@ -819,10 +828,51 @@ else
fi
fi
# If no scanners found, show installation guide and exit gracefully
if [ ${#AVAILABLE_SCANNERS[@]} -eq 0 ]; then
log_message "ERROR: No scanners found!"
log_message "WARNING: No scanners found on this system"
echo ""
echo -e "${RED}No malware scanners detected!${NC}"
exit 1
echo ""
echo -e "${YELLOW}Available Malware Scanners:${NC}"
echo ""
echo -e "${CYAN}ImunifyAV${NC} - FREE real-time malware scanner"
echo " Status: Not installed"
echo " Installation (cPanel):"
echo " yum install imunify-antivirus imunify-antivirus-cpanel"
echo " /opt/alt/python35/share/imunify360/scripts/av-userside-plugin.sh"
echo " Installation (manual):"
echo " wget https://repo.imunify360.cloudlinux.com/defence360/imav-deploy.sh"
echo " bash imav-deploy.sh"
echo " Docs: https://docs.imunify360.com/imunifyav/"
echo ""
echo -e "${CYAN}ClamAV${NC} - Open source antivirus engine"
echo " Status: Not installed"
echo " Installation:"
echo " yum install clamav clamav-update # RHEL/CentOS"
echo " apt-get install clamav clamav-daemon # Debian/Ubuntu"
echo ""
echo -e "${CYAN}Maldet (LMD)${NC} - Linux Malware Detect"
echo " Status: Not installed"
echo " Installation:"
echo " cd /tmp && wget http://www.rfxn.com/downloads/maldetect-current.tar.gz"
echo " tar -xzf maldetect-current.tar.gz && cd maldetect-*"
echo " ./install.sh"
echo ""
echo -e "${CYAN}Rootkit Hunter${NC} - Rootkit/backdoor/exploit scanner"
echo " Status: Not installed"
echo " Installation:"
echo " yum install epel-release rkhunter # RHEL/CentOS"
echo " apt-get install rkhunter # Debian/Ubuntu"
echo ""
echo -e "${YELLOW}Recommendation:${NC} Install at least ClamAV + RKHunter (both free)"
echo ""
exit 0
fi
log_message "Found ${#AVAILABLE_SCANNERS[@]} scanner(s): ${AVAILABLE_SCANNERS[*]}"