From 0137c891581374a16f1041a35d952af2421bf8f3 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Fri, 1 Jul 2022 08:26:23 -0400 Subject: [PATCH] Island: Add preliminary Simulation class Includes just the island's mode for now. --- monkey/monkey_island/cc/models/simulation.py | 21 ++++++++++++++++++++ vulture_allowlist.py | 3 +++ 2 files changed, 24 insertions(+) create mode 100644 monkey/monkey_island/cc/models/simulation.py diff --git a/monkey/monkey_island/cc/models/simulation.py b/monkey/monkey_island/cc/models/simulation.py new file mode 100644 index 000000000..9e22c4998 --- /dev/null +++ b/monkey/monkey_island/cc/models/simulation.py @@ -0,0 +1,21 @@ +from __future__ import annotations + +from dataclasses import dataclass + +from marshmallow import Schema, post_load +from marshmallow_enum import EnumField + +from monkey_island.cc.services.mode.mode_enum import IslandModeEnum + + +@dataclass(frozen=True) +class Simulation: + mode: IslandModeEnum + + +class SimulationSchema(Schema): + mode = EnumField(IslandModeEnum) + + @post_load + def _make_simulation(self, data, **kwargs): + return Simulation(**data) diff --git a/vulture_allowlist.py b/vulture_allowlist.py index 126f6c596..0db82d5e1 100644 --- a/vulture_allowlist.py +++ b/vulture_allowlist.py @@ -197,6 +197,9 @@ _make_network_scan_configuration # unused method (monkey/common/configuration/a _make_propagation_configuration # unused method (monkey/common/configuration/agent_configuration.py:167) _make_agent_configuration # unused method (monkey/common/configuration/agent_configuration.py:192) +# Models +_make_simulation # unused method (monkey/monkey_island/cc/models/simulation.py:19 + # TODO DELETE AFTER RESOURCE REFACTORING NetworkMap