forked from p15670423/monkey
Island: Modify ICredentialsRepository to save a Sequence of Credentials
This commit is contained in:
parent
68fe2edd08
commit
7bcf49daf9
|
@ -43,7 +43,7 @@ class ICredentialsRepository(ABC):
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def save_configured_credentials(self, credentials: Credentials):
|
def save_configured_credentials(self, credentials: Sequence[Credentials]):
|
||||||
"""
|
"""
|
||||||
Save credentials that were configured.
|
Save credentials that were configured.
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ class ICredentialsRepository(ABC):
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def save_stolen_credentials(self, credentials: 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.
|
||||||
|
|
||||||
|
|
|
@ -34,15 +34,15 @@ class MongoCredentialsRepository(ICredentialsRepository):
|
||||||
except RetrievalError as err:
|
except RetrievalError as err:
|
||||||
raise err
|
raise err
|
||||||
|
|
||||||
def save_configured_credentials(self, credentials: Credentials):
|
def save_configured_credentials(self, credentials: Sequence[Credentials]):
|
||||||
try:
|
try:
|
||||||
mongo.db.configured_credentials.insert_one(credentials)
|
mongo.db.configured_credentials.insert_many(credentials)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
raise StorageError(err)
|
raise StorageError(err)
|
||||||
|
|
||||||
def save_stolen_credentials(self, credentials: Credentials):
|
def save_stolen_credentials(self, credentials: Sequence[Credentials]):
|
||||||
try:
|
try:
|
||||||
mongo.db.stolen_credentials.insert_one(credentials)
|
mongo.db.stolen_credentials.insert_many(credentials)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
raise StorageError(err)
|
raise StorageError(err)
|
||||||
|
|
||||||
|
|
|
@ -47,10 +47,10 @@ class StubPropagationCredentialsRepository(ICredentialsRepository):
|
||||||
Credentials.from_mapping(PROPAGATION_CREDENTIALS_2, monkey_guid="second_guid"),
|
Credentials.from_mapping(PROPAGATION_CREDENTIALS_2, monkey_guid="second_guid"),
|
||||||
]
|
]
|
||||||
|
|
||||||
def save_configured_credentials(self, credentials: Credentials):
|
def save_configured_credentials(self, credentials: Sequence[Credentials]):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def save_stolen_credentials(self, credentials: Credentials):
|
def save_stolen_credentials(self, credentials: Sequence[Credentials]):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def remove_configured_credentials(self):
|
def remove_configured_credentials(self):
|
||||||
|
|
Loading…
Reference in New Issue