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
This commit is contained in:
Developer
2026-04-02 16:34:34 -04:00
parent b1062f4d40
commit 7382c9c2ac
+16
View File
@@ -1144,6 +1144,22 @@ else
fi fi
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 no scanners found, show installation guide and exit gracefully
if [ ${#AVAILABLE_SCANNERS[@]} -eq 0 ]; then if [ ${#AVAILABLE_SCANNERS[@]} -eq 0 ]; then
log_message "WARNING: No scanners found on this system" log_message "WARNING: No scanners found on this system"