From 475f6bc567db203dbf15d08cc783eeeeb5ebe548 Mon Sep 17 00:00:00 2001 From: vakarisz Date: Fri, 8 Jul 2022 14:21:27 +0300 Subject: [PATCH] Island: Remove outdated "island_configuration" endpoints --- monkey/monkey_island/cc/app.py | 2 -- .../cc/resources/island_configuration.py | 36 ------------------- 2 files changed, 38 deletions(-) delete mode 100644 monkey/monkey_island/cc/resources/island_configuration.py diff --git a/monkey/monkey_island/cc/app.py b/monkey/monkey_island/cc/app.py index 6a8876e21..408839b6c 100644 --- a/monkey/monkey_island/cc/app.py +++ b/monkey/monkey_island/cc/app.py @@ -32,7 +32,6 @@ from monkey_island.cc.resources.edge import Edge from monkey_island.cc.resources.exploitations.manual_exploitation import ManualExploitation from monkey_island.cc.resources.exploitations.monkey_exploitation import MonkeyExploitation from monkey_island.cc.resources.ip_addresses import IpAddresses -from monkey_island.cc.resources.island_configuration import IslandConfiguration from monkey_island.cc.resources.island_logs import IslandLog from monkey_island.cc.resources.island_mode import IslandMode from monkey_island.cc.resources.local_run import LocalRun @@ -161,7 +160,6 @@ def init_restful_endpoints(api: FlaskDIWrapper): api.add_resource(Telemetry) api.add_resource(IslandMode) - api.add_resource(IslandConfiguration) api.add_resource(AgentConfiguration) api.add_resource(AgentBinaries) api.add_resource(NetMap) diff --git a/monkey/monkey_island/cc/resources/island_configuration.py b/monkey/monkey_island/cc/resources/island_configuration.py deleted file mode 100644 index 411960f53..000000000 --- a/monkey/monkey_island/cc/resources/island_configuration.py +++ /dev/null @@ -1,36 +0,0 @@ -import json - -from flask import abort, jsonify, request - -from monkey_island.cc.resources.AbstractResource import AbstractResource -from monkey_island.cc.resources.request_authentication import jwt_required -from monkey_island.cc.services.config import ConfigService - - -class IslandConfiguration(AbstractResource): - - urls = ["/api/configuration/island"] - - @jwt_required - def get(self): - return jsonify( - schema=ConfigService.get_config_schema(), - configuration=ConfigService.get_config(True, True), - ) - - @jwt_required - def post(self): - config_json = json.loads(request.data) - # API Spec: Makes more sense to have a PATCH request for this since the resource, - # i.e. the configuration, is being updated. - if "reset" in config_json: - pass - else: - if not ConfigService.update_config(config_json, should_encrypt=True): - abort(400) - # API Spec: We're updating the config and then returning the config back? - # RESTfulness of a POST request is to return an identifier of the updated/newly created - # resource. Since there's only one thing we're updating (and not multiple "resources"), - # should this also be an RPC-style endpoint (/api/resetConfig and /api/updateConfig)? - # Simplest way it to just send a GET request after this to get the updated config. - return self.get()