forked from p15670423/monkey
Island: Remove outdated "island_configuration" endpoints
This commit is contained in:
parent
50540da780
commit
475f6bc567
|
@ -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)
|
||||
|
|
|
@ -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()
|
Loading…
Reference in New Issue