forked from p15670423/monkey
Island: Remove "/api/client-monkey" endpoint
This commit is contained in:
parent
e9895a04f5
commit
9d22185064
|
@ -17,7 +17,6 @@ from monkey_island.cc.resources.blackbox.monkey_blackbox_endpoint import MonkeyB
|
||||||
from monkey_island.cc.resources.blackbox.telemetry_blackbox_endpoint import (
|
from monkey_island.cc.resources.blackbox.telemetry_blackbox_endpoint import (
|
||||||
TelemetryBlackboxEndpoint,
|
TelemetryBlackboxEndpoint,
|
||||||
)
|
)
|
||||||
from monkey_island.cc.resources.client_run import ClientRun
|
|
||||||
from monkey_island.cc.resources.configuration_export import ConfigurationExport
|
from monkey_island.cc.resources.configuration_export import ConfigurationExport
|
||||||
from monkey_island.cc.resources.configuration_import import ConfigurationImport
|
from monkey_island.cc.resources.configuration_import import ConfigurationImport
|
||||||
from monkey_island.cc.resources.edge import Edge
|
from monkey_island.cc.resources.edge import Edge
|
||||||
|
@ -123,7 +122,6 @@ def init_api_resources(api):
|
||||||
"/api/monkey/<string:guid>/<string:config_format>",
|
"/api/monkey/<string:guid>/<string:config_format>",
|
||||||
)
|
)
|
||||||
api.add_resource(LocalRun, "/api/local-monkey")
|
api.add_resource(LocalRun, "/api/local-monkey")
|
||||||
api.add_resource(ClientRun, "/api/client-monkey")
|
|
||||||
api.add_resource(Telemetry, "/api/telemetry", "/api/telemetry/<string:monkey_guid>")
|
api.add_resource(Telemetry, "/api/telemetry", "/api/telemetry/<string:monkey_guid>")
|
||||||
|
|
||||||
api.add_resource(IslandMode, "/api/island-mode")
|
api.add_resource(IslandMode, "/api/island-mode")
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
import logging
|
|
||||||
|
|
||||||
import flask_restful
|
|
||||||
from flask import jsonify, request
|
|
||||||
|
|
||||||
from monkey_island.cc.services.node import NodeService
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
class ClientRun(flask_restful.Resource):
|
|
||||||
def get(self):
|
|
||||||
client_ip = request.remote_addr
|
|
||||||
if client_ip == "127.0.0.1":
|
|
||||||
monkey = NodeService.get_monkey_island_monkey()
|
|
||||||
else:
|
|
||||||
monkey = NodeService.get_monkey_by_ip(client_ip)
|
|
||||||
if monkey is not None:
|
|
||||||
is_monkey_running = not monkey["dead"]
|
|
||||||
else:
|
|
||||||
logger.info("Monkey is not running")
|
|
||||||
is_monkey_running = False
|
|
||||||
|
|
||||||
return jsonify(is_running=is_monkey_running)
|
|
Loading…
Reference in New Issue