Island: Add remaining repository interfaces

This commit is contained in:
vakarisz 2022-05-18 17:29:38 +03:00
parent 8f048a9b34
commit 4bbd998197
8 changed files with 70 additions and 2 deletions

View File

@ -0,0 +1,14 @@
from abc import ABC
from typing import Optional, Sequence
class ILogRepository(ABC):
# Define log object
def get_logs(self, agent_id: Optional[str] = None) -> Sequence[Log]:
pass
def save_log(self, log: Log):
pass
def delete_log(self, agent_id: str):
pass

View File

@ -0,0 +1,13 @@
from abc import ABC
from typing import Sequence
from monkey_island.cc.models import StolenCredentials
# Consider removing this interface and just using the telemetry type
class IStolenCredentialsRepository(ABC):
def get_stolen_credentials(self) -> Sequence[StolenCredentials]:
pass
def save_stolen_credentials(self, stolen_credentials: StolenCredentials):
pass

View File

@ -1,7 +1,12 @@
from abc import ABC
from typing import Sequence
from monkey_island.cc.models.exported_telem import ExportedTelem
class ITelemStoreRepository(ABC):
def get_telemetries(self):
# Used to get ExportedTelem for the Telemtry Store
def get_telemetries(self) -> Sequence[ExportedTelem]:
pass
def save_telemetry(self, telemetry: ExportedTelem):
pass

View File

View File

@ -0,0 +1,12 @@
from abc import ABC
from typing import Optional
from monkey_island.cc.models.attack.attack_mitigations import AttackMitigations
class IMitigationsRepository(ABC):
def get_mitigations(self, technique_id: Optional[str] = None) -> AttackMitigations:
pass
def save_mitigations(self, mitigations: AttackMitigations):
pass

View File

@ -0,0 +1,11 @@
from abc import ABC
from typing import Optional, Sequence
from monkey_island.cc.models.zero_trust.event import Event
class IEventRepository(ABC):
def get_events(self, finding_id: Optional[str] = None) -> Sequence[Event]:
pass
# Events are saved in IFindingRepository, because finding had many events

View File

@ -0,0 +1,13 @@
from abc import ABC
from typing import Optional
# Zero trust finding
from monkey_island.cc.models.zero_trust.finding import Finding
class IFindingRepository(ABC):
def get_findings(self, test: Optional[str] = None) -> Finding:
pass
def save_finding(self, finding: Finding):
pass