diff --git a/monkey/infection_monkey/master/exploiter.py b/monkey/infection_monkey/master/exploiter.py index b9eada5b6..8f99cba7b 100644 --- a/monkey/infection_monkey/master/exploiter.py +++ b/monkey/infection_monkey/master/exploiter.py @@ -7,6 +7,7 @@ from queue import Queue from threading import Event from typing import Callable, Dict, List, Mapping +from common import OperatingSystems from infection_monkey.custom_types import PropagationCredentials from infection_monkey.i_puppet import ExploiterResultData, IPuppet from infection_monkey.model import VictimHost @@ -20,6 +21,18 @@ ExploiterName = str Callback = Callable[[ExploiterName, VictimHost, ExploiterResultData], None] +SUPPORTED_OS = { + "HadoopExploiter": [OperatingSystems.LINUX.value, OperatingSystems.WINDOWS.value], + "Log4ShellExploiter": [OperatingSystems.LINUX.value, OperatingSystems.WINDOWS.value], + "MSSQLExploiter": [OperatingSystems.WINDOWS.value], + "PowerShellExploiter": [OperatingSystems.WINDOWS.value], + "SSHExploiter": [OperatingSystems.LINUX.value], + "SmbExploiter": [OperatingSystems.WINDOWS.value], + "WmiExploiter": [OperatingSystems.WINDOWS.value], + "ZerologonExploiter": [OperatingSystems.WINDOWS.value], +} + + class Exploiter: def __init__( self, @@ -118,7 +131,7 @@ class Exploiter: victim_os = victim_host.os.get("type") # We want to try all exploiters if the victim's OS is unknown - if victim_os is not None and victim_os not in exploiter["supported_os"]: + if victim_os is not None and victim_os not in SUPPORTED_OS[exploiter_name]: logger.debug( f"Skipping {exploiter_name} because it does not support " f"the victim's OS ({victim_os})"