Island: Add /api/clear-simulation-data
This commit is contained in:
parent
301f2fc89c
commit
8a52ad8951
|
@ -10,7 +10,12 @@ from werkzeug.exceptions import NotFound
|
||||||
|
|
||||||
from common import DIContainer
|
from common import DIContainer
|
||||||
from monkey_island.cc.database import database, mongo
|
from monkey_island.cc.database import database, mongo
|
||||||
from monkey_island.cc.resources import AgentBinaries, RemoteRun, ResetAgentConfiguration
|
from monkey_island.cc.resources import (
|
||||||
|
AgentBinaries,
|
||||||
|
ClearSimulationData,
|
||||||
|
RemoteRun,
|
||||||
|
ResetAgentConfiguration,
|
||||||
|
)
|
||||||
from monkey_island.cc.resources.AbstractResource import AbstractResource
|
from monkey_island.cc.resources.AbstractResource import AbstractResource
|
||||||
from monkey_island.cc.resources.agent_configuration import AgentConfiguration
|
from monkey_island.cc.resources.agent_configuration import AgentConfiguration
|
||||||
from monkey_island.cc.resources.agent_controls import StopAgentCheck, StopAllAgents
|
from monkey_island.cc.resources.agent_controls import StopAgentCheck, StopAllAgents
|
||||||
|
@ -199,6 +204,7 @@ def init_restful_endpoints(api: FlaskDIWrapper):
|
||||||
|
|
||||||
def init_rpc_endpoints(api: FlaskDIWrapper):
|
def init_rpc_endpoints(api: FlaskDIWrapper):
|
||||||
api.add_resource(ResetAgentConfiguration)
|
api.add_resource(ResetAgentConfiguration)
|
||||||
|
api.add_resource(ClearSimulationData)
|
||||||
|
|
||||||
|
|
||||||
def init_app(mongo_url: str, container: DIContainer):
|
def init_app(mongo_url: str, container: DIContainer):
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
from .remote_run import RemoteRun
|
from .remote_run import RemoteRun
|
||||||
from .agent_binaries import AgentBinaries
|
from .agent_binaries import AgentBinaries
|
||||||
|
from .clear_simulation_data import ClearSimulationData
|
||||||
from .reset_agent_configuration import ResetAgentConfiguration
|
from .reset_agent_configuration import ResetAgentConfiguration
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
from flask import make_response
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
|
class ClearSimulationData(AbstractResource):
|
||||||
|
urls = ["/api/clear-simulation-data"]
|
||||||
|
|
||||||
|
@jwt_required
|
||||||
|
def post(self):
|
||||||
|
"""
|
||||||
|
Clear all data collected during the simulation
|
||||||
|
"""
|
||||||
|
Database.reset_db(reset_config=False)
|
||||||
|
|
||||||
|
return make_response({}, 200)
|
Loading…
Reference in New Issue