Common: Add TCPScanConfigurationSchema
This commit is contained in:
parent
2e561181ea
commit
0b810f5d56
|
@ -9,4 +9,6 @@ from .agent_configuration import (
|
||||||
ExploiterConfigurationSchema,
|
ExploiterConfigurationSchema,
|
||||||
ExploitationConfiguration,
|
ExploitationConfiguration,
|
||||||
ExploitationConfigurationSchema,
|
ExploitationConfigurationSchema,
|
||||||
|
TCPScanConfiguration,
|
||||||
|
TCPScanConfigurationSchema,
|
||||||
)
|
)
|
||||||
|
|
|
@ -105,3 +105,12 @@ class ICMPScanConfiguration:
|
||||||
class TCPScanConfiguration:
|
class TCPScanConfiguration:
|
||||||
timeout_ms: int
|
timeout_ms: int
|
||||||
ports: List[int]
|
ports: List[int]
|
||||||
|
|
||||||
|
|
||||||
|
class TCPScanConfigurationSchema(Schema):
|
||||||
|
timeout_ms = fields.Int()
|
||||||
|
ports = fields.List(fields.Int())
|
||||||
|
|
||||||
|
@post_load
|
||||||
|
def make_tcp_scan_configuration(self, data, **kwargs):
|
||||||
|
return TCPScanConfiguration(**data)
|
||||||
|
|
|
@ -6,6 +6,7 @@ from common.configuration import (
|
||||||
ExploitationOptionsConfigurationSchema,
|
ExploitationOptionsConfigurationSchema,
|
||||||
ExploiterConfigurationSchema,
|
ExploiterConfigurationSchema,
|
||||||
PluginConfigurationSchema,
|
PluginConfigurationSchema,
|
||||||
|
TCPScanConfigurationSchema,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -95,3 +96,14 @@ def test_exploitation_configuration():
|
||||||
|
|
||||||
assert isinstance(config, ExploitationConfiguration)
|
assert isinstance(config, ExploitationConfiguration)
|
||||||
assert config_dict == exploitation_config
|
assert config_dict == exploitation_config
|
||||||
|
|
||||||
|
|
||||||
|
def test_tcp_scan_configuration_schema():
|
||||||
|
timeout_ms = 2525
|
||||||
|
ports = [8080, 443]
|
||||||
|
schema = TCPScanConfigurationSchema()
|
||||||
|
|
||||||
|
config = schema.load({"timeout_ms": timeout_ms, "ports": ports})
|
||||||
|
|
||||||
|
assert config.timeout_ms == timeout_ms
|
||||||
|
assert config.ports == ports
|
||||||
|
|
|
@ -190,6 +190,7 @@ make_plugin_configuration # unused method (monkey/common/configuration/agent_co
|
||||||
make_custom_pba_configuration # unused method (monkey/common/configuration/agent_configuration.py:34)
|
make_custom_pba_configuration # unused method (monkey/common/configuration/agent_configuration.py:34)
|
||||||
make_exploitation_options_configuration # unused method (monkey/common/configuration/agent_configuration.py:58)
|
make_exploitation_options_configuration # unused method (monkey/common/configuration/agent_configuration.py:58)
|
||||||
make_exploiter_configuration # unused method (monkey/common/configuration/agent_configuration.py:62)
|
make_exploiter_configuration # unused method (monkey/common/configuration/agent_configuration.py:62)
|
||||||
|
make_tcp_scan_configuration # unused method (monkey/common/configuration/agent_configuration.py:114)
|
||||||
LINUX # unused variable (monkey/common/operating_systems.py:5)
|
LINUX # unused variable (monkey/common/operating_systems.py:5)
|
||||||
WINDOWS # unused variable (monkey/common/operating_systems.py:6)
|
WINDOWS # unused variable (monkey/common/operating_systems.py:6)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue