forked from p34709852/monkey
Island: Make ICredentialsRepository methods abstract
This commit is contained in:
parent
a7a2968a99
commit
deacd18cbe
|
@ -1,4 +1,4 @@
|
||||||
from abc import ABC
|
from abc import ABC, abstractmethod
|
||||||
from typing import Sequence
|
from typing import Sequence
|
||||||
|
|
||||||
from common.credentials import Credentials
|
from common.credentials import Credentials
|
||||||
|
@ -13,6 +13,7 @@ class ICredentialsRepository(ABC):
|
||||||
a simulation.
|
a simulation.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
def get_configured_credentials(self) -> Sequence[Credentials]:
|
def get_configured_credentials(self) -> Sequence[Credentials]:
|
||||||
"""
|
"""
|
||||||
Retrieve credentials that were configured.
|
Retrieve credentials that were configured.
|
||||||
|
@ -22,6 +23,7 @@ class ICredentialsRepository(ABC):
|
||||||
:return: Sequence of configured credentials
|
:return: Sequence of configured credentials
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
def get_stolen_credentials(self) -> Sequence[Credentials]:
|
def get_stolen_credentials(self) -> Sequence[Credentials]:
|
||||||
"""
|
"""
|
||||||
Retrieve credentials that were stolen during a simulation.
|
Retrieve credentials that were stolen during a simulation.
|
||||||
|
@ -31,6 +33,7 @@ class ICredentialsRepository(ABC):
|
||||||
:return: Sequence of stolen credentials
|
:return: Sequence of stolen credentials
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
def get_all_credentials(self) -> Sequence[Credentials]:
|
def get_all_credentials(self) -> Sequence[Credentials]:
|
||||||
"""
|
"""
|
||||||
Retrieve all credentials in the repository.
|
Retrieve all credentials in the repository.
|
||||||
|
@ -40,6 +43,7 @@ class ICredentialsRepository(ABC):
|
||||||
:return: Sequence of stolen and configured credentials
|
:return: Sequence of stolen and configured credentials
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
def save_configured_credentials(self, credentials: Sequence[Credentials]):
|
def save_configured_credentials(self, credentials: Sequence[Credentials]):
|
||||||
"""
|
"""
|
||||||
Save credentials that were configured.
|
Save credentials that were configured.
|
||||||
|
@ -48,6 +52,7 @@ class ICredentialsRepository(ABC):
|
||||||
:raises StorageError: If an error is encountered while attempting to store the credentials
|
:raises StorageError: If an error is encountered while attempting to store the credentials
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
def save_stolen_credentials(self, credentials: Sequence[Credentials]):
|
def save_stolen_credentials(self, credentials: Sequence[Credentials]):
|
||||||
"""
|
"""
|
||||||
Save credentials that were stolen during a simulation.
|
Save credentials that were stolen during a simulation.
|
||||||
|
@ -56,6 +61,7 @@ class ICredentialsRepository(ABC):
|
||||||
:raises StorageError: If an error is encountered while attempting to store the credentials
|
:raises StorageError: If an error is encountered while attempting to store the credentials
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
def remove_configured_credentials(self):
|
def remove_configured_credentials(self):
|
||||||
"""
|
"""
|
||||||
Remove credentials that were configured from the repository.
|
Remove credentials that were configured from the repository.
|
||||||
|
@ -63,6 +69,7 @@ class ICredentialsRepository(ABC):
|
||||||
:raises RemovalError: If an error is encountered while attempting to remove the credentials
|
:raises RemovalError: If an error is encountered while attempting to remove the credentials
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
def remove_stolen_credentials(self):
|
def remove_stolen_credentials(self):
|
||||||
"""
|
"""
|
||||||
Remove stolen credentials from the repository.
|
Remove stolen credentials from the repository.
|
||||||
|
@ -70,6 +77,7 @@ class ICredentialsRepository(ABC):
|
||||||
:raises RemovalError: If an error is encountered while attempting to remove the credentials
|
:raises RemovalError: If an error is encountered while attempting to remove the credentials
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
def remove_all_credentials(self):
|
def remove_all_credentials(self):
|
||||||
"""
|
"""
|
||||||
Remove all credentials in the repository.
|
Remove all credentials in the repository.
|
||||||
|
@ -77,6 +85,7 @@ class ICredentialsRepository(ABC):
|
||||||
:raises RemovalError: If an error is encountered while attempting to remove the credentials
|
:raises RemovalError: If an error is encountered while attempting to remove the credentials
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
def reset(self):
|
def reset(self):
|
||||||
"""
|
"""
|
||||||
An alias for remove_all_credentials()
|
An alias for remove_all_credentials()
|
||||||
|
|
Loading…
Reference in New Issue