Island: Reformat "finger_classes" config options before sending to Agent

This commit is contained in:
Mike Salvatore 2021-12-13 13:58:30 -05:00
parent d51af8a583
commit e524718960
3 changed files with 20 additions and 1 deletions

View File

@ -488,6 +488,9 @@ class ConfigService:
formatted_network_scan_config["icmp"] = ConfigService._format_icmp_scan_from_flat_config(
config
)
formatted_network_scan_config[
"fingerprinters"
] = ConfigService._format_fingerprinters_from_flat_config(config)
return formatted_network_scan_config
@ -529,6 +532,15 @@ class ConfigService:
return formatted_icmp_scan_config
@staticmethod
def _format_fingerprinters_from_flat_config(config: Dict):
flat_fingerprinter_classes_field = "finger_classes"
formatted_fingerprinters = config[flat_fingerprinter_classes_field]
config.pop(flat_fingerprinter_classes_field)
return formatted_fingerprinters
@staticmethod
def _format_targets_from_flat_config(config: Dict):
flat_blocked_ips_field = "blocked_ips"

View File

@ -66,7 +66,6 @@
"SMBFinger",
"SSHFinger",
"HTTPFinger",
"MySQLFinger",
"MSSQLFinger",
"ElasticFinger"
],

View File

@ -143,6 +143,13 @@ def test_format_config_for_agent__network_scan(flat_monkey_config):
"icmp": {
"timeout_ms": 1000,
},
"fingerprinters": [
"SMBFinger",
"SSHFinger",
"HTTPFinger",
"MSSQLFinger",
"ElasticFinger",
],
}
ConfigService.format_flat_config_for_agent(flat_monkey_config)
@ -153,3 +160,4 @@ def test_format_config_for_agent__network_scan(flat_monkey_config):
assert "tcp_scan_timeout" not in flat_monkey_config
assert "tcp_target_ports" not in flat_monkey_config
assert "ping_scan_timeout" not in flat_monkey_config
assert "finger_classes" not in flat_monkey_config