forked from p34709852/monkey
Merge pull request #2065 from guardicore/1965-modify-clear-simulation-data
Modify /api/clear-simulation-data to clear stolen credentials
This commit is contained in:
commit
1ab190cd2a
|
@ -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,11 +10,15 @@ 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):
|
||||
"""
|
||||
Clear all data collected during the simulation
|
||||
"""
|
||||
Database.reset_db(reset_config=False)
|
||||
self._credentials_repository.remove_stolen_credentials()
|
||||
|
||||
return make_response({}, 200)
|
||||
|
|
Loading…
Reference in New Issue