Island: Add units TCP and ICMP timeout option

The timeout option for TCP and ICMP scans is in milliseconds. Change
"timeout" -> "timeout_ms" to avoid confusion.
This commit is contained in:
Mike Salvatore 2021-12-09 14:29:05 -05:00
parent 25410716d3
commit da8e814b95
3 changed files with 6 additions and 8 deletions

View File

@ -234,7 +234,7 @@ class AutomatedMaster(IMaster):
break break
# TODO: check units of timeout # TODO: check units of timeout
port_scan_data = self._puppet.scan_tcp_port(ip, p, options["timeout"]) port_scan_data = self._puppet.scan_tcp_port(ip, p, options["timeout_ms"])
if port_scan_data.status == PortStatus.OPEN: if port_scan_data.status == PortStatus.OPEN:
victim_host.services[port_scan_data.service] = {} victim_host.services[port_scan_data.service] = {}
victim_host.services[port_scan_data.service]["display_name"] = "unknown(TCP)" victim_host.services[port_scan_data.service]["display_name"] = "unknown(TCP)"

View File

@ -488,7 +488,7 @@ class ConfigService:
formatted_tcp_scan_config = {} formatted_tcp_scan_config = {}
formatted_tcp_scan_config["timeout"] = config[flat_tcp_timeout_field] formatted_tcp_scan_config["timeout_ms"] = config[flat_tcp_timeout_field]
ports = ConfigService._union_tcp_and_http_ports( ports = ConfigService._union_tcp_and_http_ports(
config[flat_tcp_ports_field], config[flat_http_ports_field] config[flat_tcp_ports_field], config[flat_http_ports_field]
@ -512,7 +512,7 @@ class ConfigService:
flat_ping_timeout_field = "ping_scan_timeout" flat_ping_timeout_field = "ping_scan_timeout"
formatted_icmp_scan_config = {} formatted_icmp_scan_config = {}
formatted_icmp_scan_config["timeout"] = config[flat_ping_timeout_field] formatted_icmp_scan_config["timeout_ms"] = config[flat_ping_timeout_field]
config.pop(flat_ping_timeout_field, None) config.pop(flat_ping_timeout_field, None)
@ -527,9 +527,7 @@ class ConfigService:
formatted_scan_targets_config = {} formatted_scan_targets_config = {}
formatted_scan_targets_config[flat_blocked_ips_field] = config[ formatted_scan_targets_config[flat_blocked_ips_field] = config[flat_blocked_ips_field]
flat_blocked_ips_field
]
formatted_scan_targets_config[flat_inaccessible_subnets_field] = config[ formatted_scan_targets_config[flat_inaccessible_subnets_field] = config[
flat_inaccessible_subnets_field flat_inaccessible_subnets_field
] ]

View File

@ -98,7 +98,7 @@ def test_get_config_propagation_credentials_from_flat_config(flat_monkey_config)
def test_format_config_for_agent__network_scan(flat_monkey_config): def test_format_config_for_agent__network_scan(flat_monkey_config):
expected_network_scan_config = { expected_network_scan_config = {
"tcp": { "tcp": {
"timeout": 3000, "timeout_ms": 3000,
"ports": [ "ports": [
22, 22,
80, 80,
@ -116,7 +116,7 @@ def test_format_config_for_agent__network_scan(flat_monkey_config):
], ],
}, },
"icmp": { "icmp": {
"timeout": 1000, "timeout_ms": 1000,
}, },
"targets": { "targets": {
"blocked_ips": ["192.168.1.1", "192.168.1.100"], "blocked_ips": ["192.168.1.1", "192.168.1.100"],