Island: Create `SMB_DOWNLOAD_TIMEOUT` and pass in exploiter options

This commit is contained in:
Shreya Malviya 2022-06-09 16:37:41 -07:00
parent 5e59160698
commit 8af267248b
1 changed files with 5 additions and 3 deletions

View File

@ -52,6 +52,8 @@ SENSITIVE_SSH_KEY_FIELDS = [
SensitiveField(path="public_key", field_encryptor=StringEncryptor),
]
SMB_DOWNLOAD_TIMEOUT = 30
class ConfigService:
default_config = None
@ -584,19 +586,19 @@ class ConfigService:
config.pop(flat_config_exploiter_classes_field, None)
formatted_exploiters_config = ConfigService._add_smb_download_timeout_to_exploiters(
config, formatted_exploiters_config
formatted_exploiters_config
)
return ConfigService._add_supported_os_to_exploiters(formatted_exploiters_config)
@staticmethod
def _add_smb_download_timeout_to_exploiters(
flat_config: Dict, formatted_config: Dict
formatted_config: Dict,
) -> Dict[str, List[Dict[str, Any]]]:
new_config = copy.deepcopy(formatted_config)
uses_smb_timeout = {"SmbExploiter", "WmiExploiter"}
for exploiter in filter(lambda e: e["name"] in uses_smb_timeout, new_config["brute_force"]):
exploiter["options"]["smb_download_timeout"] = flat_config["smb_download_timeout"]
exploiter["options"]["smb_download_timeout"] = SMB_DOWNLOAD_TIMEOUT
return new_config