Merge pull request #2070 from guardicore/2003-remove-unused-endpoints

2003 remove unused endpoints
This commit is contained in:
Mike Salvatore 2022-07-08 09:12:12 -04:00 committed by GitHub
commit cd839884eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 39 deletions

View File

@ -43,7 +43,7 @@ Changelog](https://keepachangelog.com/en/1.0.0/).
- Depth flag (-d) on the agent now acts the way you would expect(it represents
the current depth of the agent, not hops remaining). #2033
- Agent configuration structure. #1996, #1998, #1961, #1997, #1994, #1741,
#1761, #1695, #1605, #2028
#1761, #1695, #1605, #2028, #2003
- `/api/island-mode` to accept and return new "unset" mode. #2036
### Removed
@ -88,6 +88,7 @@ Changelog](https://keepachangelog.com/en/1.0.0/).
- Option to export monkey telemetries. #1998
- "/api/configuration/import" endpoint. #2002
- "/api/configuration/export" endpoint. #2002
- "/api/island-configuration" endpoint. #2003
### Fixed
- A bug in network map page that caused delay of telemetry log loading. #1545

View File

@ -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)

View File

@ -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()