forked from p34709852/monkey
Island: Simplify the names of fingerprinters in the config
This commit is contained in:
parent
6d5b55be10
commit
207a65e2a9
|
@ -2,6 +2,7 @@ import collections
|
||||||
import copy
|
import copy
|
||||||
import functools
|
import functools
|
||||||
import logging
|
import logging
|
||||||
|
import re
|
||||||
from typing import Dict, List
|
from typing import Dict, List
|
||||||
|
|
||||||
from jsonschema import Draft4Validator, validators
|
from jsonschema import Draft4Validator, validators
|
||||||
|
@ -548,11 +549,16 @@ class ConfigService:
|
||||||
for fp in formatted_fingerprinters:
|
for fp in formatted_fingerprinters:
|
||||||
if fp["name"] == "HTTPFinger":
|
if fp["name"] == "HTTPFinger":
|
||||||
fp["options"] = {"http_ports": sorted(config[flat_http_ports_field])}
|
fp["options"] = {"http_ports": sorted(config[flat_http_ports_field])}
|
||||||
break
|
|
||||||
|
fp["name"] = ConfigService._translate_fingerprinter_name(fp["name"])
|
||||||
|
|
||||||
config.pop(flat_fingerprinter_classes_field)
|
config.pop(flat_fingerprinter_classes_field)
|
||||||
return formatted_fingerprinters
|
return formatted_fingerprinters
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _translate_fingerprinter_name(name: str):
|
||||||
|
return re.sub(r"Finger", "", name).lower()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _format_targets_from_flat_config(config: Dict):
|
def _format_targets_from_flat_config(config: Dict):
|
||||||
flat_blocked_ips_field = "blocked_ips"
|
flat_blocked_ips_field = "blocked_ips"
|
||||||
|
|
|
@ -147,14 +147,14 @@ def test_format_config_for_agent__network_scan(flat_monkey_config):
|
||||||
"timeout_ms": 1000,
|
"timeout_ms": 1000,
|
||||||
},
|
},
|
||||||
"fingerprinters": [
|
"fingerprinters": [
|
||||||
{"name": "ElasticFinger", "options": {}},
|
{"name": "elastic", "options": {}},
|
||||||
{
|
{
|
||||||
"name": "HTTPFinger",
|
"name": "http",
|
||||||
"options": {"http_ports": [80, 443, 7001, 8008, 8080, 9200]},
|
"options": {"http_ports": [80, 443, 7001, 8008, 8080, 9200]},
|
||||||
},
|
},
|
||||||
{"name": "MSSQLFinger", "options": {}},
|
{"name": "mssql", "options": {}},
|
||||||
{"name": "SMBFinger", "options": {}},
|
{"name": "smb", "options": {}},
|
||||||
{"name": "SSHFinger", "options": {}},
|
{"name": "ssh", "options": {}},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
ConfigService.format_flat_config_for_agent(flat_monkey_config)
|
ConfigService.format_flat_config_for_agent(flat_monkey_config)
|
||||||
|
|
Loading…
Reference in New Issue