Island: Add StubbedEventRepository

A placeholder until MongoEventRepository is implemented
This commit is contained in:
Mike Salvatore 2022-09-14 13:35:49 -04:00
parent 83f1e4cc2a
commit f5711e2fab
3 changed files with 36 additions and 1 deletions

View File

@ -26,3 +26,4 @@ from .mongo_credentials_repository import MongoCredentialsRepository
from .mongo_machine_repository import MongoMachineRepository
from .mongo_agent_repository import MongoAgentRepository
from .mongo_node_repository import MongoNodeRepository
from .stubbed_event_repository import StubbedEventRepository

View File

@ -0,0 +1,29 @@
from typing import Sequence, Type, TypeVar
from common.events import AbstractAgentEvent
from common.types import AgentID
from . import IEventRepository
T = TypeVar("T", bound=AbstractAgentEvent)
# TODO: Remove this class after #2180 is complete
class StubbedEventRepository(IEventRepository):
def save_event(self, event: AbstractAgentEvent):
return
def get_events(self) -> Sequence[AbstractAgentEvent]:
return []
def get_events_by_type(self, event_type: Type[T]) -> Sequence[T]:
return []
def get_events_by_tag(self, tag: str) -> Sequence[AbstractAgentEvent]:
return []
def get_events_by_source(self, source: AgentID) -> Sequence[AbstractAgentEvent]:
return []
def reset(self):
return

View File

@ -12,7 +12,11 @@ from infection_monkey.exploit.log4shell_utils.ldap_server import LDAPServerFacto
from monkey_island.cc.event_queue import IslandEventTopic, PyPubSubIslandEventQueue
from monkey_island.cc.models import Report
from monkey_island.cc.models.networkmap import Arc, NetworkMap
from monkey_island.cc.repository import MongoAgentRepository, MongoMachineRepository
from monkey_island.cc.repository import (
MongoAgentRepository,
MongoMachineRepository,
StubbedEventRepository,
)
from monkey_island.cc.repository.attack.IMitigationsRepository import IMitigationsRepository
from monkey_island.cc.repository.i_agent_repository import IAgentRepository
from monkey_island.cc.repository.i_attack_repository import IAttackRepository
@ -279,6 +283,7 @@ IEventRepository.get_events
IFindingRepository.get_findings
MongoAgentRepository
MongoMachineRepository
StubbedEventRepository
key_list
simulation
netmap