forked from p34709852/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 functools
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
|
from itertools import chain
|
||||||
from typing import Any, Dict, List
|
from typing import Any, Dict, List
|
||||||
|
|
||||||
from jsonschema import Draft4Validator, validators
|
from jsonschema import Draft4Validator, validators
|
||||||
|
@ -629,9 +630,10 @@ class ConfigService:
|
||||||
|
|
||||||
config.pop(flat_config_exploiter_classes_field, None)
|
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
|
config, formatted_exploiters_config
|
||||||
)
|
)
|
||||||
|
return ConfigService._add_supported_os_to_exploiters(formatted_exploiters_config)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _add_smb_download_timeout_to_exploiters(
|
def _add_smb_download_timeout_to_exploiters(
|
||||||
|
@ -644,3 +646,23 @@ class ConfigService:
|
||||||
exploiter["options"]["smb_download_timeout"] = flat_config["smb_download_timeout"]
|
exploiter["options"]["smb_download_timeout"] = flat_config["smb_download_timeout"]
|
||||||
|
|
||||||
return new_config
|
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",
|
"HadoopExploiter",
|
||||||
"MSSQLExploiter",
|
"MSSQLExploiter",
|
||||||
"DrupalExploiter",
|
"DrupalExploiter",
|
||||||
"PowerShellExploiter"
|
"PowerShellExploiter",
|
||||||
|
"Log4ShellExploiter"
|
||||||
],
|
],
|
||||||
"export_monkey_telems": false,
|
"export_monkey_telems": false,
|
||||||
"finger_classes": [
|
"finger_classes": [
|
||||||
|
|
|
@ -177,18 +177,27 @@ def test_format_config_for_agent__exploiters(flat_monkey_config):
|
||||||
"http_ports": [80, 443, 7001, 8008, 8080, 9200],
|
"http_ports": [80, 443, 7001, 8008, 8080, 9200],
|
||||||
},
|
},
|
||||||
"brute_force": [
|
"brute_force": [
|
||||||
{"name": "MSSQLExploiter", "options": {}},
|
{"name": "MSSQLExploiter", "supported_os": ["windows"], "options": {}},
|
||||||
{"name": "PowerShellExploiter", "options": {}},
|
{"name": "PowerShellExploiter", "supported_os": ["windows"], "options": {}},
|
||||||
{"name": "SSHExploiter", "options": {}},
|
{"name": "SSHExploiter", "supported_os": ["linux"], "options": {}},
|
||||||
{"name": "SmbExploiter", "options": {"smb_download_timeout": 300}},
|
{
|
||||||
{"name": "WmiExploiter", "options": {"smb_download_timeout": 300}},
|
"name": "SmbExploiter",
|
||||||
|
"supported_os": ["windows"],
|
||||||
|
"options": {"smb_download_timeout": 300},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "WmiExploiter",
|
||||||
|
"supported_os": ["windows"],
|
||||||
|
"options": {"smb_download_timeout": 300},
|
||||||
|
},
|
||||||
],
|
],
|
||||||
"vulnerability": [
|
"vulnerability": [
|
||||||
{"name": "DrupalExploiter", "options": {}},
|
{"name": "DrupalExploiter", "supported_os": [], "options": {}},
|
||||||
{"name": "HadoopExploiter", "options": {}},
|
{"name": "HadoopExploiter", "supported_os": ["linux", "windows"], "options": {}},
|
||||||
{"name": "Struts2Exploiter", "options": {}},
|
{"name": "Log4ShellExploiter", "supported_os": ["linux", "windows"], "options": {}},
|
||||||
{"name": "WebLogicExploiter", "options": {}},
|
{"name": "Struts2Exploiter", "supported_os": [], "options": {}},
|
||||||
{"name": "ZerologonExploiter", "options": {}},
|
{"name": "WebLogicExploiter", "supported_os": [], "options": {}},
|
||||||
|
{"name": "ZerologonExploiter", "supported_os": ["windows"], "options": {}},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
ConfigService.format_flat_config_for_agent(flat_monkey_config)
|
ConfigService.format_flat_config_for_agent(flat_monkey_config)
|
||||||
|
|
Loading…
Reference in New Issue