Island: Add debug logging to Agents resource

This commit is contained in:
Mike Salvatore 2022-08-22 14:49:31 -04:00
parent 9c32dee739
commit ab399e4f34
1 changed files with 7 additions and 1 deletions

View File

@ -1,4 +1,5 @@
import json
import logging
from http import HTTPStatus
from flask import make_response, request
@ -6,6 +7,8 @@ from flask import make_response, request
from common import AgentRegistrationData
from monkey_island.cc.resources.AbstractResource import AbstractResource
logger = logging.getLogger(__name__)
class Agents(AbstractResource):
urls = ["/api/agents"]
@ -13,7 +16,10 @@ class Agents(AbstractResource):
def post(self):
try:
# Just parse for now
AgentRegistrationData(**request.json)
agent_registration_data = AgentRegistrationData(**request.json)
logger.debug(f"Agent registered: {agent_registration_data}")
return make_response({}, HTTPStatus.NO_CONTENT)
except (TypeError, ValueError, json.JSONDecodeError) as err:
return make_response(