Island: Add smb_download_timeout to SMB and WMI exploiter options

This commit is contained in:
Mike Salvatore 2022-03-08 15:13:00 -05:00 committed by vakarisz
parent 6862ef39ee
commit e76b46c8ca
2 changed files with 17 additions and 3 deletions

View File

@ -629,4 +629,18 @@ class ConfigService:
config.pop(flat_config_exploiter_classes_field, None)
return formatted_exploiters_config
return ConfigService._add_smb_download_timeout_to_exploiters(
config, formatted_exploiters_config
)
@staticmethod
def _add_smb_download_timeout_to_exploiters(
flat_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"]
return new_config

View File

@ -180,8 +180,8 @@ def test_format_config_for_agent__exploiters(flat_monkey_config):
{"name": "MSSQLExploiter", "options": {}},
{"name": "PowerShellExploiter", "options": {}},
{"name": "SSHExploiter", "options": {}},
{"name": "SmbExploiter", "options": {}},
{"name": "WmiExploiter", "options": {}},
{"name": "SmbExploiter", "options": {"smb_download_timeout": 300}},
{"name": "WmiExploiter", "options": {"smb_download_timeout": 300}},
],
"vulnerability": [
{"name": "DrupalExploiter", "options": {}},