forked from p15670423/monkey
Island: Format fingerprinter config with options
This commit is contained in:
parent
4b2fb260c3
commit
a989e5543a
|
@ -538,10 +538,19 @@ class ConfigService:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _format_fingerprinters_from_flat_config(config: Dict):
|
def _format_fingerprinters_from_flat_config(config: Dict):
|
||||||
flat_fingerprinter_classes_field = "finger_classes"
|
flat_fingerprinter_classes_field = "finger_classes"
|
||||||
|
flat_http_ports_field = "HTTP_PORTS"
|
||||||
|
|
||||||
|
formatted_fingerprinters = [
|
||||||
|
{"name": f, "options": {}} for f in sorted(config[flat_fingerprinter_classes_field])
|
||||||
|
]
|
||||||
|
|
||||||
|
if "HTTPFinger" in config[flat_fingerprinter_classes_field]:
|
||||||
|
for fp in formatted_fingerprinters:
|
||||||
|
if fp["name"] == "HTTPFinger":
|
||||||
|
fp["options"] = {"http_ports": sorted(config[flat_http_ports_field])}
|
||||||
|
break
|
||||||
|
|
||||||
formatted_fingerprinters = config[flat_fingerprinter_classes_field]
|
|
||||||
config.pop(flat_fingerprinter_classes_field)
|
config.pop(flat_fingerprinter_classes_field)
|
||||||
|
|
||||||
return formatted_fingerprinters
|
return formatted_fingerprinters
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
|
@ -147,11 +147,14 @@ def test_format_config_for_agent__network_scan(flat_monkey_config):
|
||||||
"timeout_ms": 1000,
|
"timeout_ms": 1000,
|
||||||
},
|
},
|
||||||
"fingerprinters": [
|
"fingerprinters": [
|
||||||
"SMBFinger",
|
{"name": "ElasticFinger", "options": {}},
|
||||||
"SSHFinger",
|
{
|
||||||
"HTTPFinger",
|
"name": "HTTPFinger",
|
||||||
"MSSQLFinger",
|
"options": {"http_ports": [80, 443, 7001, 8008, 8080, 9200]},
|
||||||
"ElasticFinger",
|
},
|
||||||
|
{"name": "MSSQLFinger", "options": {}},
|
||||||
|
{"name": "SMBFinger", "options": {}},
|
||||||
|
{"name": "SSHFinger", "options": {}},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
ConfigService.format_flat_config_for_agent(flat_monkey_config)
|
ConfigService.format_flat_config_for_agent(flat_monkey_config)
|
||||||
|
|
Loading…
Reference in New Issue