forked from p15670423/monkey
Island: Add a list of supported OSs to exploiters
This commit is contained in:
parent
1ec5be908d
commit
b73c3d10e1
|
@ -3,6 +3,7 @@ import copy
|
|||
import functools
|
||||
import logging
|
||||
import re
|
||||
from itertools import chain
|
||||
from typing import Any, Dict, List
|
||||
|
||||
from jsonschema import Draft4Validator, validators
|
||||
|
@ -629,9 +630,10 @@ class ConfigService:
|
|||
|
||||
config.pop(flat_config_exploiter_classes_field, None)
|
||||
|
||||
return ConfigService._add_smb_download_timeout_to_exploiters(
|
||||
formatted_exploiters_config = ConfigService._add_smb_download_timeout_to_exploiters(
|
||||
config, formatted_exploiters_config
|
||||
)
|
||||
return ConfigService._add_supported_os_to_exploiters(formatted_exploiters_config)
|
||||
|
||||
@staticmethod
|
||||
def _add_smb_download_timeout_to_exploiters(
|
||||
|
@ -644,3 +646,23 @@ class ConfigService:
|
|||
exploiter["options"]["smb_download_timeout"] = flat_config["smb_download_timeout"]
|
||||
|
||||
return new_config
|
||||
|
||||
@staticmethod
|
||||
def _add_supported_os_to_exploiters(
|
||||
formatted_config: Dict,
|
||||
) -> Dict[str, List[Dict[str, Any]]]:
|
||||
supported_os = {
|
||||
"HadoopExploiter": ["linux", "windows"],
|
||||
"Log4ShellExploiter": ["linux", "windows"],
|
||||
"MSSQLExploiter": ["windows"],
|
||||
"PowerShellExploiter": ["windows"],
|
||||
"SSHExploiter": ["linux"],
|
||||
"SmbExploiter": ["windows"],
|
||||
"WmiExploiter": ["windows"],
|
||||
"ZerologonExploiter": ["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
|
||||
|
|
|
@ -55,7 +55,8 @@
|
|||
"HadoopExploiter",
|
||||
"MSSQLExploiter",
|
||||
"DrupalExploiter",
|
||||
"PowerShellExploiter"
|
||||
"PowerShellExploiter",
|
||||
"Log4ShellExploiter"
|
||||
],
|
||||
"export_monkey_telems": false,
|
||||
"finger_classes": [
|
||||
|
|
|
@ -177,18 +177,27 @@ def test_format_config_for_agent__exploiters(flat_monkey_config):
|
|||
"http_ports": [80, 443, 7001, 8008, 8080, 9200],
|
||||
},
|
||||
"brute_force": [
|
||||
{"name": "MSSQLExploiter", "options": {}},
|
||||
{"name": "PowerShellExploiter", "options": {}},
|
||||
{"name": "SSHExploiter", "options": {}},
|
||||
{"name": "SmbExploiter", "options": {"smb_download_timeout": 300}},
|
||||
{"name": "WmiExploiter", "options": {"smb_download_timeout": 300}},
|
||||
{"name": "MSSQLExploiter", "supported_os": ["windows"], "options": {}},
|
||||
{"name": "PowerShellExploiter", "supported_os": ["windows"], "options": {}},
|
||||
{"name": "SSHExploiter", "supported_os": ["linux"], "options": {}},
|
||||
{
|
||||
"name": "SmbExploiter",
|
||||
"supported_os": ["windows"],
|
||||
"options": {"smb_download_timeout": 300},
|
||||
},
|
||||
{
|
||||
"name": "WmiExploiter",
|
||||
"supported_os": ["windows"],
|
||||
"options": {"smb_download_timeout": 300},
|
||||
},
|
||||
],
|
||||
"vulnerability": [
|
||||
{"name": "DrupalExploiter", "options": {}},
|
||||
{"name": "HadoopExploiter", "options": {}},
|
||||
{"name": "Struts2Exploiter", "options": {}},
|
||||
{"name": "WebLogicExploiter", "options": {}},
|
||||
{"name": "ZerologonExploiter", "options": {}},
|
||||
{"name": "DrupalExploiter", "supported_os": [], "options": {}},
|
||||
{"name": "HadoopExploiter", "supported_os": ["linux", "windows"], "options": {}},
|
||||
{"name": "Log4ShellExploiter", "supported_os": ["linux", "windows"], "options": {}},
|
||||
{"name": "Struts2Exploiter", "supported_os": [], "options": {}},
|
||||
{"name": "WebLogicExploiter", "supported_os": [], "options": {}},
|
||||
{"name": "ZerologonExploiter", "supported_os": ["windows"], "options": {}},
|
||||
],
|
||||
}
|
||||
ConfigService.format_flat_config_for_agent(flat_monkey_config)
|
||||
|
|
Loading…
Reference in New Issue