forked from p34709852/monkey
Island: Add /api/reset-agent-configuration RPC endpoint
This commit is contained in:
parent
03ec893e97
commit
6d4920e47f
|
@ -10,7 +10,7 @@ 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
|
from monkey_island.cc.resources import AgentBinaries, 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
|
||||||
|
@ -198,7 +198,7 @@ def init_restful_endpoints(api: FlaskDIWrapper):
|
||||||
|
|
||||||
|
|
||||||
def init_rpc_endpoints(api: FlaskDIWrapper):
|
def init_rpc_endpoints(api: FlaskDIWrapper):
|
||||||
pass
|
api.add_resource(ResetAgentConfiguration)
|
||||||
|
|
||||||
|
|
||||||
def init_app(mongo_url: str, container: DIContainer):
|
def init_app(mongo_url: str, container: DIContainer):
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
from .remote_run import RemoteRun
|
from .remote_run import RemoteRun
|
||||||
from .agent_binaries import AgentBinaries
|
from .agent_binaries import AgentBinaries
|
||||||
|
from .reset_agent_configuration import ResetAgentConfiguration
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
from flask import make_response
|
||||||
|
|
||||||
|
from monkey_island.cc.repository import IAgentConfigurationRepository
|
||||||
|
from monkey_island.cc.resources.AbstractResource import AbstractResource
|
||||||
|
from monkey_island.cc.resources.request_authentication import jwt_required
|
||||||
|
|
||||||
|
|
||||||
|
class ResetAgentConfiguration(AbstractResource):
|
||||||
|
urls = ["/api/reset-agent-configuration"]
|
||||||
|
|
||||||
|
def __init__(self, agent_configuration_repository: IAgentConfigurationRepository):
|
||||||
|
self._agent_configuration_repository = agent_configuration_repository
|
||||||
|
|
||||||
|
@jwt_required
|
||||||
|
def post(self):
|
||||||
|
"""
|
||||||
|
Reset the agent configuration to its default values
|
||||||
|
"""
|
||||||
|
self._agent_configuration_repository.reset_to_default()
|
||||||
|
|
||||||
|
return make_response({}, 200)
|
Loading…
Reference in New Issue