Common: Add ICMPScanConfigurationSchema

This commit is contained in:
Mike Salvatore 2022-06-17 08:20:26 -04:00
parent 0b810f5d56
commit ee8e949a0d
3 changed files with 20 additions and 0 deletions

View File

@ -9,6 +9,8 @@ from .agent_configuration import (
ExploiterConfigurationSchema, ExploiterConfigurationSchema,
ExploitationConfiguration, ExploitationConfiguration,
ExploitationConfigurationSchema, ExploitationConfigurationSchema,
ICMPScanConfiguration,
ICMPScanConfigurationSchema,
TCPScanConfiguration, TCPScanConfiguration,
TCPScanConfigurationSchema, TCPScanConfigurationSchema,
) )

View File

@ -101,6 +101,14 @@ class ICMPScanConfiguration:
timeout_ms: int timeout_ms: int
class ICMPScanConfigurationSchema(Schema):
timeout_ms = fields.Int()
@post_load
def make_icmp_scan_configuration(self, data, **kwargs):
return ICMPScanConfiguration(**data)
@dataclass(frozen=True) @dataclass(frozen=True)
class TCPScanConfiguration: class TCPScanConfiguration:
timeout_ms: int timeout_ms: int

View File

@ -5,6 +5,7 @@ from common.configuration import (
ExploitationConfigurationSchema, ExploitationConfigurationSchema,
ExploitationOptionsConfigurationSchema, ExploitationOptionsConfigurationSchema,
ExploiterConfigurationSchema, ExploiterConfigurationSchema,
ICMPScanConfigurationSchema,
PluginConfigurationSchema, PluginConfigurationSchema,
TCPScanConfigurationSchema, TCPScanConfigurationSchema,
) )
@ -98,6 +99,15 @@ def test_exploitation_configuration():
assert config_dict == exploitation_config assert config_dict == exploitation_config
def test_icmp_scan_configuration_schema():
timeout_ms = 2525
schema = ICMPScanConfigurationSchema()
config = schema.load({"timeout_ms": timeout_ms})
assert config.timeout_ms == timeout_ms
def test_tcp_scan_configuration_schema(): def test_tcp_scan_configuration_schema():
timeout_ms = 2525 timeout_ms = 2525
ports = [8080, 443] ports = [8080, 443]