forked from p15670423/monkey
Agent: Add `SUPPORTED_OS` dict for exploiters and change checking logic in master
This commit is contained in:
parent
26ece213a2
commit
fd41d9179e
|
@ -7,6 +7,7 @@ from queue import Queue
|
||||||
from threading import Event
|
from threading import Event
|
||||||
from typing import Callable, Dict, List, Mapping
|
from typing import Callable, Dict, List, Mapping
|
||||||
|
|
||||||
|
from common import OperatingSystems
|
||||||
from infection_monkey.custom_types import PropagationCredentials
|
from infection_monkey.custom_types import PropagationCredentials
|
||||||
from infection_monkey.i_puppet import ExploiterResultData, IPuppet
|
from infection_monkey.i_puppet import ExploiterResultData, IPuppet
|
||||||
from infection_monkey.model import VictimHost
|
from infection_monkey.model import VictimHost
|
||||||
|
@ -20,6 +21,18 @@ ExploiterName = str
|
||||||
Callback = Callable[[ExploiterName, VictimHost, ExploiterResultData], None]
|
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:
|
class Exploiter:
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
|
@ -118,7 +131,7 @@ class Exploiter:
|
||||||
victim_os = victim_host.os.get("type")
|
victim_os = victim_host.os.get("type")
|
||||||
|
|
||||||
# We want to try all exploiters if the victim's OS is unknown
|
# 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(
|
logger.debug(
|
||||||
f"Skipping {exploiter_name} because it does not support "
|
f"Skipping {exploiter_name} because it does not support "
|
||||||
f"the victim's OS ({victim_os})"
|
f"the victim's OS ({victim_os})"
|
||||||
|
|
Loading…
Reference in New Issue