diff --git a/monkey/monkey_island/cc/environment/__init__.py b/monkey/monkey_island/cc/environment/__init__.py index 5680b40e6..5c25526b0 100644 --- a/monkey/monkey_island/cc/environment/__init__.py +++ b/monkey/monkey_island/cc/environment/__init__.py @@ -3,6 +3,7 @@ import logging import os from abc import ABCMeta, abstractmethod from datetime import timedelta +import json __author__ = 'itay.mizeretz' @@ -52,6 +53,7 @@ class Environment(object, metaclass=ABCMeta): raise InvalidRegistrationCredentialsError("Missing part of credentials.") if self._try_needs_registration(): self._config.add_user(credentials) + logger.info(f"New user {credentials.username} registered!") def _try_needs_registration(self) -> bool: if not self._credentials_required: diff --git a/monkey/monkey_island/cc/resources/environment.py b/monkey/monkey_island/cc/resources/environment.py index 5a768133c..f03b40b2c 100644 --- a/monkey/monkey_island/cc/resources/environment.py +++ b/monkey/monkey_island/cc/resources/environment.py @@ -1,16 +1,19 @@ import json +import logging from flask import request import flask_restful import monkey_island.cc.environment.environment_singleton as env_singleton +logger = logging.getLogger(__name__) + class Environment(flask_restful.Resource): - def patch(self): env_data = json.loads(request.data) if env_data['server_config'] == "standard": if env_singleton.env.needs_registration(): env_singleton.set_to_standard() + logger.warning("No user registered, Island on standard mode - no credentials required to access.") return {}