Common: Add ExploitationOptionsConfiguration

This commit is contained in:
Mike Salvatore 2022-06-16 20:00:23 -04:00
parent 70e8bca1ea
commit afd3160c2f
4 changed files with 26 additions and 0 deletions

View File

@ -3,6 +3,8 @@ from .agent_configuration import (
PluginConfigurationSchema,
CustomPBAConfiguration,
CustomPBAConfigurationSchema,
ExploitationOptionsConfiguration,
ExploitationOptionsConfigurationSchema,
ExploiterConfiguration,
ExploiterConfigurationSchema,
)

View File

@ -47,6 +47,19 @@ class PluginConfigurationSchema(Schema):
return PluginConfiguration(**data)
@dataclass(frozen=True)
class ExploitationOptionsConfiguration:
http_ports: List[int]
class ExploitationOptionsConfigurationSchema(Schema):
http_ports = fields.List(fields.Int())
@post_load
def make_exploitation_options_configuration(self, data, **kwargs):
return ExploitationOptionsConfiguration(**data)
@dataclass(frozen=True)
class ExploiterConfiguration:
name: str

View File

@ -1,6 +1,7 @@
from common import OperatingSystems
from common.configuration import (
CustomPBAConfigurationSchema,
ExploitationOptionsConfigurationSchema,
ExploiterConfigurationSchema,
PluginConfigurationSchema,
)
@ -39,6 +40,15 @@ def test_custom_pba_configuration_schema():
assert config.windows_filename == windows_filename
def test_exploitation_options_configuration_schema():
ports = [1, 2, 3]
schema = ExploitationOptionsConfigurationSchema()
config = schema.load({"http_ports": ports})
assert config.http_ports == ports
def test_exploiter_configuration_schema():
name = "bond"
options = {"gun": "Walther PPK", "car": "Aston Martin DB5"}

View File

@ -188,6 +188,7 @@ Meta # unused class (monkey/common/configuration/agent_configuration.py:13)
unknown # unused variable (monkey/common/configuration/agent_configuration.py:14)
make_plugin_configuration # unused method (monkey/common/configuration/agent_configuration.py:19)
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_exploiter_configuration # unused method (monkey/common/configuration/agent_configuration.py:62)
LINUX # unused variable (monkey/common/operating_systems.py:5)
WINDOWS # unused variable (monkey/common/operating_systems.py:6)