forked from p34709852/monkey
Common: Add PluginConfiguration
This commit is contained in:
parent
660c1421c0
commit
c79f62e682
|
@ -0,0 +1 @@
|
|||
from .agent_configuration import PluginConfiguration, PluginConfigurationSchema
|
|
@ -0,0 +1,21 @@
|
|||
from dataclasses import dataclass
|
||||
|
||||
from marshmallow import RAISE, Schema, fields, post_load
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class PluginConfiguration:
|
||||
name: str
|
||||
options: dict
|
||||
|
||||
|
||||
class PluginConfigurationSchema(Schema):
|
||||
class Meta:
|
||||
unknown = RAISE
|
||||
|
||||
name = fields.Str()
|
||||
options = fields.Mapping()
|
||||
|
||||
@post_load
|
||||
def make_plugin_configuration(self, data, **kwargs):
|
||||
return PluginConfiguration(**data)
|
|
@ -0,0 +1,12 @@
|
|||
from common.configuration import PluginConfigurationSchema
|
||||
|
||||
|
||||
def test_build_plugin_configuration():
|
||||
name = "bond"
|
||||
options = {"gun": "Walther PPK", "car": "Aston Martin DB5"}
|
||||
pcs = PluginConfigurationSchema()
|
||||
|
||||
pc = pcs.load({"name": name, "options": options})
|
||||
|
||||
assert pc.name == name
|
||||
assert pc.options == options
|
|
@ -183,6 +183,12 @@ architecture # unused variable (monkey/infection_monkey/exploit/caching_agent_r
|
|||
|
||||
response_code # unused variable (monkey/monkey_island/cc/services/aws/aws_command_runner.py:26)
|
||||
|
||||
# Agent Configuration
|
||||
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)
|
||||
|
||||
|
||||
# TODO DELETE AFTER RESOURCE REFACTORING
|
||||
NetworkMap
|
||||
Arc.dst_machine
|
||||
|
|
Loading…
Reference in New Issue