forked from p15670423/monkey
Common: Add ExploitationOptionsConfiguration
This commit is contained in:
parent
70e8bca1ea
commit
afd3160c2f
|
@ -3,6 +3,8 @@ from .agent_configuration import (
|
||||||
PluginConfigurationSchema,
|
PluginConfigurationSchema,
|
||||||
CustomPBAConfiguration,
|
CustomPBAConfiguration,
|
||||||
CustomPBAConfigurationSchema,
|
CustomPBAConfigurationSchema,
|
||||||
|
ExploitationOptionsConfiguration,
|
||||||
|
ExploitationOptionsConfigurationSchema,
|
||||||
ExploiterConfiguration,
|
ExploiterConfiguration,
|
||||||
ExploiterConfigurationSchema,
|
ExploiterConfigurationSchema,
|
||||||
)
|
)
|
||||||
|
|
|
@ -47,6 +47,19 @@ class PluginConfigurationSchema(Schema):
|
||||||
return PluginConfiguration(**data)
|
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)
|
@dataclass(frozen=True)
|
||||||
class ExploiterConfiguration:
|
class ExploiterConfiguration:
|
||||||
name: str
|
name: str
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
from common import OperatingSystems
|
from common import OperatingSystems
|
||||||
from common.configuration import (
|
from common.configuration import (
|
||||||
CustomPBAConfigurationSchema,
|
CustomPBAConfigurationSchema,
|
||||||
|
ExploitationOptionsConfigurationSchema,
|
||||||
ExploiterConfigurationSchema,
|
ExploiterConfigurationSchema,
|
||||||
PluginConfigurationSchema,
|
PluginConfigurationSchema,
|
||||||
)
|
)
|
||||||
|
@ -39,6 +40,15 @@ def test_custom_pba_configuration_schema():
|
||||||
assert config.windows_filename == windows_filename
|
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():
|
def test_exploiter_configuration_schema():
|
||||||
name = "bond"
|
name = "bond"
|
||||||
options = {"gun": "Walther PPK", "car": "Aston Martin DB5"}
|
options = {"gun": "Walther PPK", "car": "Aston Martin DB5"}
|
||||||
|
|
|
@ -188,6 +188,7 @@ Meta # unused class (monkey/common/configuration/agent_configuration.py:13)
|
||||||
unknown # unused variable (monkey/common/configuration/agent_configuration.py:14)
|
unknown # unused variable (monkey/common/configuration/agent_configuration.py:14)
|
||||||
make_plugin_configuration # unused method (monkey/common/configuration/agent_configuration.py:19)
|
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_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)
|
make_exploiter_configuration # unused method (monkey/common/configuration/agent_configuration.py:62)
|
||||||
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