Island: Add definition for GET in new Configuration resource

This commit is contained in:
Shreya Malviya 2022-06-20 19:50:38 -07:00
parent 7a28ba4c4d
commit 5dd27eeea5
1 changed files with 16 additions and 3 deletions

View File

@ -1,13 +1,26 @@
from enum import Enum
from flask import jsonify, request
from monkey_island.cc.resources.AbstractResource import AbstractResource from monkey_island.cc.resources.AbstractResource import AbstractResource
from monkey_island.cc.resources.request_authentication import jwt_required from monkey_island.cc.resources.request_authentication import jwt_required
from monkey_island.cc.repository import FileAgentConfigurationRepository
class ConfigurationTypeEnum(Enum):
ISLAND = "island"
AGENT = "agent"
class Configuration(AbstractResource): class Configuration(AbstractResource):
urls = ["/api/configuration"] urls = ["/api/configuration/<string:configuration_type>"]
@jwt_required @jwt_required
def get(self): def get(self, configuration_type: str):
pass # we probably still need this because of credential fields, HTTP ports, etc in the config?
if configuration_type == ConfigurationTypeEnum.ISLAND:
pass
elif configuration_type == ConfigurationTypeEnum.AGENT:
configuration = FileAgentConfigurationRepository.get_configuration()
return jsonify(configuration=configuration)
@jwt_required @jwt_required
def post(self): def post(self):