forked from p15670423/monkey
Common: Add ICMPScanConfigurationSchema
This commit is contained in:
parent
0b810f5d56
commit
ee8e949a0d
|
@ -9,6 +9,8 @@ from .agent_configuration import (
|
|||
ExploiterConfigurationSchema,
|
||||
ExploitationConfiguration,
|
||||
ExploitationConfigurationSchema,
|
||||
ICMPScanConfiguration,
|
||||
ICMPScanConfigurationSchema,
|
||||
TCPScanConfiguration,
|
||||
TCPScanConfigurationSchema,
|
||||
)
|
||||
|
|
|
@ -101,6 +101,14 @@ class ICMPScanConfiguration:
|
|||
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)
|
||||
class TCPScanConfiguration:
|
||||
timeout_ms: int
|
||||
|
|
|
@ -5,6 +5,7 @@ from common.configuration import (
|
|||
ExploitationConfigurationSchema,
|
||||
ExploitationOptionsConfigurationSchema,
|
||||
ExploiterConfigurationSchema,
|
||||
ICMPScanConfigurationSchema,
|
||||
PluginConfigurationSchema,
|
||||
TCPScanConfigurationSchema,
|
||||
)
|
||||
|
@ -98,6 +99,15 @@ def test_exploitation_configuration():
|
|||
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():
|
||||
timeout_ms = 2525
|
||||
ports = [8080, 443]
|
||||
|
|
Loading…
Reference in New Issue