forked from p15670423/monkey
Island: Remove stolen credentials when clearing simulation data
This commit is contained in:
parent
833513e383
commit
e34bb760e3
|
@ -1,5 +1,7 @@
|
|||
from flask import make_response
|
||||
|
||||
from monkey_island.cc.repository import RemovalError
|
||||
from monkey_island.cc.repository.i_credentials_repository import ICredentialsRepository
|
||||
from monkey_island.cc.resources.AbstractResource import AbstractResource
|
||||
from monkey_island.cc.resources.request_authentication import jwt_required
|
||||
from monkey_island.cc.services.database import Database
|
||||
|
@ -8,6 +10,9 @@ from monkey_island.cc.services.database import Database
|
|||
class ClearSimulationData(AbstractResource):
|
||||
urls = ["/api/clear-simulation-data"]
|
||||
|
||||
def __init__(self, credentials_repository: ICredentialsRepository):
|
||||
self._credentials_repository = credentials_repository
|
||||
|
||||
@jwt_required
|
||||
def post(self):
|
||||
"""
|
||||
|
@ -15,4 +20,11 @@ class ClearSimulationData(AbstractResource):
|
|||
"""
|
||||
Database.reset_db(reset_config=False)
|
||||
|
||||
try:
|
||||
self._credentials_repository.remove_stolen_credentials()
|
||||
except RemovalError as err:
|
||||
make_response(
|
||||
{"error": f"Error encountered while removing stolen credentials: {err}"}, 400
|
||||
)
|
||||
|
||||
return make_response({}, 200)
|
||||
|
|
Loading…
Reference in New Issue