diff --git a/monkey/infection_monkey/config.py b/monkey/infection_monkey/config.py index 0a64f51da..b26762fc5 100644 --- a/monkey/infection_monkey/config.py +++ b/monkey/infection_monkey/config.py @@ -14,7 +14,6 @@ HIDDEN_FIELD_REPLACEMENT_CONTENT = "hidden" class Configuration(object): def from_kv(self, formatted_data): - unknown_items = [] for key, value in list(formatted_data.items()): if key.startswith("_"): continue @@ -22,11 +21,8 @@ class Configuration(object): continue if hasattr(self, key): setattr(self, key, value) - else: - unknown_items.append(key) if not self.max_depth: self.max_depth = self.depth - return unknown_items @staticmethod def hide_sensitive_info(config_dict): diff --git a/monkey/infection_monkey/control.py b/monkey/infection_monkey/control.py index b6568a860..77b52fe3f 100644 --- a/monkey/infection_monkey/control.py +++ b/monkey/infection_monkey/control.py @@ -185,7 +185,7 @@ class ControlClient(object): return try: - unknown_variables = WormConfiguration.from_kv(reply.json().get("config")) + WormConfiguration.from_kv(reply.json().get("config")) formatted_config = pformat( WormConfiguration.hide_sensitive_info(WormConfiguration.as_dict()) ) @@ -200,28 +200,6 @@ class ControlClient(object): ) raise Exception("Couldn't load from from server's configuration, aborting. %s" % exc) - if unknown_variables: - ControlClient.send_config_error() - - @staticmethod - def send_config_error(): - if not WormConfiguration.current_server: - return - try: - requests.patch( # noqa: DUO123 - f"https://{WormConfiguration.current_server}/api/agent/{GUID}", - data=json.dumps({"config_error": True}), - headers={"content-type": "application/json"}, - verify=False, - proxies=ControlClient.proxies, - timeout=MEDIUM_REQUEST_TIMEOUT, - ) - except Exception as exc: - logger.warning( - "Error connecting to control server %s: %s", WormConfiguration.current_server, exc - ) - return {} - @staticmethod def create_control_tunnel(): if not WormConfiguration.current_server: