From 7382c9c2acced45957aa4ca948e7c50df9f1248e Mon Sep 17 00:00:00 2001 From: Developer Date: Thu, 2 Apr 2026 16:34:34 -0400 Subject: [PATCH] fix: Implement Maldet-only filtering when MALDET_ONLY environment variable is set - Add filter logic to detect MALDET_ONLY=1 and restrict AVAILABLE_SCANNERS to Maldet only - Verify Maldet is actually installed before filtering - Show clear message when running in Maldet-only mode - Prevents unintended multi-scanner scans when user selects Maldet menu option --- modules/security/malware-scanner.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/modules/security/malware-scanner.sh b/modules/security/malware-scanner.sh index 6ebd605..ef69f58 100755 --- a/modules/security/malware-scanner.sh +++ b/modules/security/malware-scanner.sh @@ -1144,6 +1144,22 @@ else fi fi +# Filter scanners if MALDET_ONLY is set (for Maldet-specific menu) +if [ "${MALDET_ONLY:-0}" = "1" ]; then + log_message "Maldet-only mode enabled" + echo "🔍 Running Maldet-only scan (fastest, Linux-focused)" + echo "" + # Check if Maldet is available + if [[ " ${AVAILABLE_SCANNERS[@]} " =~ " maldet " ]]; then + AVAILABLE_SCANNERS=("maldet") + log_message "Filtered to Maldet only" + else + log_message "ERROR: Maldet not installed but MALDET_ONLY was set" + echo -e "${RED}ERROR: Maldet is not installed${NC}" + exit 1 + fi +fi + # If no scanners found, show installation guide and exit gracefully if [ ${#AVAILABLE_SCANNERS[@]} -eq 0 ]; then log_message "WARNING: No scanners found on this system"