Island: Remove logic to add `supported_os` for exploiters to configuration

This commit is contained in:
Shreya Malviya 2022-06-22 08:30:44 -07:00
parent 03037b5662
commit 26ece213a2
1 changed files with 1 additions and 23 deletions

View File

@ -3,12 +3,10 @@ import copy
import functools import functools
import logging import logging
import re import re
from itertools import chain
from typing import Any, Dict, List from typing import Any, Dict, List
from jsonschema import Draft4Validator, validators from jsonschema import Draft4Validator, validators
from common import OperatingSystems
from common.config_value_paths import ( from common.config_value_paths import (
LM_HASH_LIST_PATH, LM_HASH_LIST_PATH,
NTLM_HASH_LIST_PATH, NTLM_HASH_LIST_PATH,
@ -580,7 +578,7 @@ class ConfigService:
formatted_exploiters_config = ConfigService._add_smb_download_timeout_to_exploiters( formatted_exploiters_config = ConfigService._add_smb_download_timeout_to_exploiters(
formatted_exploiters_config formatted_exploiters_config
) )
return ConfigService._add_supported_os_to_exploiters(formatted_exploiters_config) return formatted_exploiters_config
@staticmethod @staticmethod
def _add_smb_download_timeout_to_exploiters( def _add_smb_download_timeout_to_exploiters(
@ -593,23 +591,3 @@ class ConfigService:
exploiter["options"]["smb_download_timeout"] = SMB_DOWNLOAD_TIMEOUT exploiter["options"]["smb_download_timeout"] = SMB_DOWNLOAD_TIMEOUT
return new_config return new_config
@staticmethod
def _add_supported_os_to_exploiters(
formatted_config: Dict,
) -> Dict[str, List[Dict[str, Any]]]:
supported_os = {
"HadoopExploiter": [OperatingSystems.LINUX, OperatingSystems.WINDOWS],
"Log4ShellExploiter": [OperatingSystems.LINUX, OperatingSystems.WINDOWS],
"MSSQLExploiter": [OperatingSystems.WINDOWS],
"PowerShellExploiter": [OperatingSystems.WINDOWS],
"SSHExploiter": [OperatingSystems.LINUX],
"SmbExploiter": [OperatingSystems.WINDOWS],
"WmiExploiter": [OperatingSystems.WINDOWS],
"ZerologonExploiter": [OperatingSystems.WINDOWS],
}
new_config = copy.deepcopy(formatted_config)
for exploiter in chain(new_config["brute_force"], new_config["vulnerability"]):
exploiter["supported_os"] = supported_os.get(exploiter["name"], [])
return new_config