Island: Modify config to add exploiters and exploit options

This commit is contained in:
Ilija Lazoroski 2022-02-18 20:04:24 +01:00
parent 915c58e8cc
commit cecf131528
2 changed files with 32 additions and 14 deletions

View File

@ -602,7 +602,20 @@ class ConfigService:
"WmiExploiter",
}
formatted_exploiters_config = {"brute_force": [], "vulnerability": []}
exploit_options = {}
for dropper_target in [
"dropper_target_path_linux",
"dropper_target_path_win_32",
"dropper_target_path_win_64",
]:
exploit_options[dropper_target] = config.get(dropper_target, "")
formatted_exploiters_config = {
"options": exploit_options,
"brute_force": [],
"vulnerability": [],
}
for exploiter in sorted(config[flat_config_exploiter_classes_field]):
category = (
@ -611,7 +624,7 @@ class ConfigService:
else vulnerability_category
)
formatted_exploiters_config[category].append({"name": exploiter})
formatted_exploiters_config[category].append({"name": exploiter, "options": {}})
config.pop(flat_config_exploiter_classes_field, None)

View File

@ -171,21 +171,26 @@ def test_format_config_for_agent__network_scan(flat_monkey_config):
def test_format_config_for_agent__exploiters(flat_monkey_config):
expected_exploiters_config = {
"options": {
"dropper_target_path_linux": "/tmp/monkey",
"dropper_target_path_win_32": r"C:\Windows\temp\monkey32.exe",
"dropper_target_path_win_64": r"C:\Windows\temp\monkey64.exe",
},
"brute_force": [
{"name": "MSSQLExploiter"},
{"name": "PowerShellExploiter"},
{"name": "SSHExploiter"},
{"name": "SmbExploiter"},
{"name": "WmiExploiter"},
{"name": "MSSQLExploiter", "options": {}},
{"name": "PowerShellExploiter", "options": {}},
{"name": "SSHExploiter", "options": {}},
{"name": "SmbExploiter", "options": {}},
{"name": "WmiExploiter", "options": {}},
],
"vulnerability": [
{"name": "DrupalExploiter"},
{"name": "ElasticGroovyExploiter"},
{"name": "HadoopExploiter"},
{"name": "ShellShockExploiter"},
{"name": "Struts2Exploiter"},
{"name": "WebLogicExploiter"},
{"name": "ZerologonExploiter"},
{"name": "DrupalExploiter", "options": {}},
{"name": "ElasticGroovyExploiter", "options": {}},
{"name": "HadoopExploiter", "options": {}},
{"name": "ShellShockExploiter", "options": {}},
{"name": "Struts2Exploiter", "options": {}},
{"name": "WebLogicExploiter", "options": {}},
{"name": "ZerologonExploiter", "options": {}},
],
}
ConfigService.format_flat_config_for_agent(flat_monkey_config)