forked from p34709852/monkey
Island: Remove StopAllAgents resource
This commit is contained in:
parent
263fff28f3
commit
637978648a
|
@ -26,7 +26,7 @@ from monkey_island.cc.resources import (
|
||||||
ResetAgentConfiguration,
|
ResetAgentConfiguration,
|
||||||
)
|
)
|
||||||
from monkey_island.cc.resources.AbstractResource import AbstractResource
|
from monkey_island.cc.resources.AbstractResource import AbstractResource
|
||||||
from monkey_island.cc.resources.agent_controls import StopAgentCheck, StopAllAgents
|
from monkey_island.cc.resources.agent_controls import StopAgentCheck
|
||||||
from monkey_island.cc.resources.attack.attack_report import AttackReport
|
from monkey_island.cc.resources.attack.attack_report import AttackReport
|
||||||
from monkey_island.cc.resources.auth import Authenticate, Register, RegistrationStatus, init_jwt
|
from monkey_island.cc.resources.auth import Authenticate, Register, RegistrationStatus, init_jwt
|
||||||
from monkey_island.cc.resources.blackbox.log_blackbox_endpoint import LogBlackboxEndpoint
|
from monkey_island.cc.resources.blackbox.log_blackbox_endpoint import LogBlackboxEndpoint
|
||||||
|
@ -199,7 +199,6 @@ def init_restful_endpoints(api: FlaskDIWrapper):
|
||||||
api.add_resource(RemoteRun)
|
api.add_resource(RemoteRun)
|
||||||
api.add_resource(Version)
|
api.add_resource(Version)
|
||||||
api.add_resource(StopAgentCheck)
|
api.add_resource(StopAgentCheck)
|
||||||
api.add_resource(StopAllAgents)
|
|
||||||
|
|
||||||
# Resources used by black box tests
|
# Resources used by black box tests
|
||||||
# API Spec: Fix all the following endpoints, see comments in the resource classes
|
# API Spec: Fix all the following endpoints, see comments in the resource classes
|
||||||
|
|
|
@ -1,2 +1 @@
|
||||||
from .stop_all_agents import StopAllAgents
|
|
||||||
from .stop_agent_check import StopAgentCheck
|
from .stop_agent_check import StopAgentCheck
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
import json
|
|
||||||
|
|
||||||
from flask import make_response, request
|
|
||||||
|
|
||||||
from monkey_island.cc.resources.AbstractResource import AbstractResource
|
|
||||||
from monkey_island.cc.resources.request_authentication import jwt_required
|
|
||||||
from monkey_island.cc.resources.utils.semaphores import agent_killing_mutex
|
|
||||||
from monkey_island.cc.services.infection_lifecycle import set_stop_all, should_agent_die
|
|
||||||
|
|
||||||
|
|
||||||
class StopAllAgents(AbstractResource):
|
|
||||||
# API Spec: This is an action and there's no "resource"; RPC-style endpoint?
|
|
||||||
urls = ["/api/monkey-control/stop-all-agents"]
|
|
||||||
|
|
||||||
@jwt_required
|
|
||||||
def post(self):
|
|
||||||
with agent_killing_mutex:
|
|
||||||
data = json.loads(request.data)
|
|
||||||
if data["kill_time"]:
|
|
||||||
set_stop_all(data["kill_time"])
|
|
||||||
return make_response({}, 200)
|
|
||||||
else:
|
|
||||||
return make_response({}, 400)
|
|
||||||
|
|
||||||
# API Spec: This is the exact same thing as what's in StopAgentCheck
|
|
||||||
def get(self, monkey_guid):
|
|
||||||
return {"stop_agent": should_agent_die(monkey_guid)}
|
|
Loading…
Reference in New Issue