forked from p15670423/monkey
Island: Move IslandModeEnum to monkey_island.cc.models
This commit is contained in:
parent
7ec558a5f4
commit
63a69b047d
|
@ -8,4 +8,4 @@ from .monkey_ttl import MonkeyTtl
|
||||||
from .pba_results import PbaResults
|
from .pba_results import PbaResults
|
||||||
from monkey_island.cc.models.report.report import Report
|
from monkey_island.cc.models.report.report import Report
|
||||||
from .stolen_credentials import StolenCredentials
|
from .stolen_credentials import StolenCredentials
|
||||||
from .simulation import Simulation, SimulationSchema
|
from .simulation import Simulation, SimulationSchema, IslandModeEnum
|
||||||
|
|
|
@ -1,11 +1,16 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
from enum import Enum
|
||||||
|
|
||||||
from marshmallow import Schema, post_load
|
from marshmallow import Schema, post_load
|
||||||
from marshmallow_enum import EnumField
|
from marshmallow_enum import EnumField
|
||||||
|
|
||||||
from monkey_island.cc.services.mode.mode_enum import IslandModeEnum
|
|
||||||
|
class IslandModeEnum(Enum):
|
||||||
|
UNSET = "unset"
|
||||||
|
RANSOMWARE = "ransomware"
|
||||||
|
ADVANCED = "advanced"
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True)
|
||||||
|
|
|
@ -2,9 +2,8 @@ import dataclasses
|
||||||
import io
|
import io
|
||||||
|
|
||||||
from monkey_island.cc import repository
|
from monkey_island.cc import repository
|
||||||
from monkey_island.cc.models import Simulation, SimulationSchema
|
from monkey_island.cc.models import IslandModeEnum, Simulation, SimulationSchema
|
||||||
from monkey_island.cc.repository import IFileRepository, ISimulationRepository, RetrievalError
|
from monkey_island.cc.repository import IFileRepository, ISimulationRepository, RetrievalError
|
||||||
from monkey_island.cc.services.mode.mode_enum import IslandModeEnum
|
|
||||||
|
|
||||||
SIMULATION_STATE_FILE_NAME = "simulation_state.json"
|
SIMULATION_STATE_FILE_NAME = "simulation_state.json"
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
|
|
||||||
from monkey_island.cc.models import Simulation
|
from monkey_island.cc.models import IslandModeEnum, Simulation
|
||||||
from monkey_island.cc.services.mode.mode_enum import IslandModeEnum
|
|
||||||
|
|
||||||
|
|
||||||
class ISimulationRepository(ABC):
|
class ISimulationRepository(ABC):
|
||||||
|
|
|
@ -3,10 +3,10 @@ import logging
|
||||||
|
|
||||||
from flask import make_response, request
|
from flask import make_response, request
|
||||||
|
|
||||||
|
from monkey_island.cc.models import IslandModeEnum
|
||||||
from monkey_island.cc.resources.AbstractResource import AbstractResource
|
from monkey_island.cc.resources.AbstractResource import AbstractResource
|
||||||
from monkey_island.cc.resources.request_authentication import jwt_required
|
from monkey_island.cc.resources.request_authentication import jwt_required
|
||||||
from monkey_island.cc.services import IslandModeService
|
from monkey_island.cc.services import IslandModeService
|
||||||
from monkey_island.cc.services.mode.mode_enum import IslandModeEnum
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from common.configuration import AgentConfiguration
|
from common.configuration import AgentConfiguration
|
||||||
|
from monkey_island.cc.models import IslandModeEnum
|
||||||
from monkey_island.cc.repository import IAgentConfigurationRepository, ISimulationRepository
|
from monkey_island.cc.repository import IAgentConfigurationRepository, ISimulationRepository
|
||||||
from monkey_island.cc.services.mode.mode_enum import IslandModeEnum
|
|
||||||
|
|
||||||
|
|
||||||
class IslandModeService:
|
class IslandModeService:
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
import dataclasses
|
import dataclasses
|
||||||
|
|
||||||
from monkey_island.cc.models import Simulation
|
from monkey_island.cc.models import IslandModeEnum, Simulation
|
||||||
from monkey_island.cc.repository import ISimulationRepository
|
from monkey_island.cc.repository import ISimulationRepository
|
||||||
from monkey_island.cc.services.mode.mode_enum import IslandModeEnum
|
|
||||||
|
|
||||||
|
|
||||||
class InMemorySimulationRepository(ISimulationRepository):
|
class InMemorySimulationRepository(ISimulationRepository):
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
import pytest
|
import pytest
|
||||||
from tests.monkey_island import OpenErrorFileRepository, SingleFileRepository
|
from tests.monkey_island import OpenErrorFileRepository, SingleFileRepository
|
||||||
|
|
||||||
from monkey_island.cc.models import Simulation
|
from monkey_island.cc.models import IslandModeEnum, Simulation
|
||||||
from monkey_island.cc.repository import FileSimulationRepository, RetrievalError
|
from monkey_island.cc.repository import FileSimulationRepository, RetrievalError
|
||||||
from monkey_island.cc.services.mode.mode_enum import IslandModeEnum
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
|
|
@ -5,10 +5,10 @@ import pytest
|
||||||
from tests.common import StubDIContainer
|
from tests.common import StubDIContainer
|
||||||
from tests.monkey_island import InMemorySimulationRepository
|
from tests.monkey_island import InMemorySimulationRepository
|
||||||
|
|
||||||
|
from monkey_island.cc.models import IslandModeEnum
|
||||||
from monkey_island.cc.repository import RetrievalError
|
from monkey_island.cc.repository import RetrievalError
|
||||||
from monkey_island.cc.resources.island_mode import IslandMode as IslandModeResource
|
from monkey_island.cc.resources.island_mode import IslandMode as IslandModeResource
|
||||||
from monkey_island.cc.services import IslandModeService
|
from monkey_island.cc.services import IslandModeService
|
||||||
from monkey_island.cc.services.mode.mode_enum import IslandModeEnum
|
|
||||||
|
|
||||||
|
|
||||||
class MockIslandModeService(IslandModeService):
|
class MockIslandModeService(IslandModeService):
|
||||||
|
|
|
@ -2,8 +2,8 @@ import pytest
|
||||||
from tests.monkey_island import InMemoryAgentConfigurationRepository, InMemorySimulationRepository
|
from tests.monkey_island import InMemoryAgentConfigurationRepository, InMemorySimulationRepository
|
||||||
|
|
||||||
from common.configuration import DEFAULT_AGENT_CONFIGURATION, DEFAULT_RANSOMWARE_AGENT_CONFIGURATION
|
from common.configuration import DEFAULT_AGENT_CONFIGURATION, DEFAULT_RANSOMWARE_AGENT_CONFIGURATION
|
||||||
|
from monkey_island.cc.models import IslandModeEnum
|
||||||
from monkey_island.cc.services import IslandModeService
|
from monkey_island.cc.services import IslandModeService
|
||||||
from monkey_island.cc.services.mode.mode_enum import IslandModeEnum
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
|
Loading…
Reference in New Issue