Island: Use OperatingSystems enum in config.py

This commit is contained in:
vakarisz 2022-06-20 12:18:03 +03:00
parent 02dcee8bfc
commit c0f0d35f0b
1 changed files with 10 additions and 11 deletions

View File

@ -8,6 +8,7 @@ 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,
@ -533,9 +534,7 @@ class ConfigService:
formatted_scan_targets_config[flat_local_network_scan_field] = config[ formatted_scan_targets_config[flat_local_network_scan_field] = config[
flat_local_network_scan_field flat_local_network_scan_field
] ]
formatted_scan_targets_config["subnets"] = config[ formatted_scan_targets_config["subnets"] = config[flat_subnet_scan_list_field]
flat_subnet_scan_list_field
]
config.pop(flat_blocked_ips_field, None) config.pop(flat_blocked_ips_field, None)
config.pop(flat_inaccessible_subnets_field, None) config.pop(flat_inaccessible_subnets_field, None)
@ -600,14 +599,14 @@ class ConfigService:
formatted_config: Dict, formatted_config: Dict,
) -> Dict[str, List[Dict[str, Any]]]: ) -> Dict[str, List[Dict[str, Any]]]:
supported_os = { supported_os = {
"HadoopExploiter": ["LINUX", "WINDOWS"], "HadoopExploiter": [OperatingSystems.LINUX, OperatingSystems.WINDOWS],
"Log4ShellExploiter": ["LINUX", "WINDOWS"], "Log4ShellExploiter": [OperatingSystems.LINUX, OperatingSystems.WINDOWS],
"MSSQLExploiter": ["WINDOWS"], "MSSQLExploiter": [OperatingSystems.WINDOWS],
"PowerShellExploiter": ["WINDOWS"], "PowerShellExploiter": [OperatingSystems.WINDOWS],
"SSHExploiter": ["LINUX"], "SSHExploiter": [OperatingSystems.LINUX],
"SmbExploiter": ["WINDOWS"], "SmbExploiter": [OperatingSystems.WINDOWS],
"WmiExploiter": ["WINDOWS"], "WmiExploiter": [OperatingSystems.WINDOWS],
"ZerologonExploiter": ["WINDOWS"], "ZerologonExploiter": [OperatingSystems.WINDOWS],
} }
new_config = copy.deepcopy(formatted_config) new_config = copy.deepcopy(formatted_config)
for exploiter in chain(new_config["brute_force"], new_config["vulnerability"]): for exploiter in chain(new_config["brute_force"], new_config["vulnerability"]):