From d347521a298b2c87c98b43b81424ebf682dab762 Mon Sep 17 00:00:00 2001 From: vakaris_zilius Date: Fri, 2 Sep 2022 07:40:49 +0000 Subject: [PATCH] Island, Agent: Fix bugs in credential object creation --- monkey/infection_monkey/master/control_channel.py | 2 +- monkey/monkey_island/cc/resources/propagation_credentials.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/monkey/infection_monkey/master/control_channel.py b/monkey/infection_monkey/master/control_channel.py index 28b6d7533..8c6653573 100644 --- a/monkey/infection_monkey/master/control_channel.py +++ b/monkey/infection_monkey/master/control_channel.py @@ -121,7 +121,7 @@ class ControlChannel(IControlChannel): ) response.raise_for_status() - return [Credentials.from_mapping(credentials) for credentials in response.json()] + return [Credentials(**credentials) for credentials in response.json()] except ( requests.exceptions.JSONDecodeError, requests.exceptions.ConnectionError, diff --git a/monkey/monkey_island/cc/resources/propagation_credentials.py b/monkey/monkey_island/cc/resources/propagation_credentials.py index 22d717e72..6700bffd3 100644 --- a/monkey/monkey_island/cc/resources/propagation_credentials.py +++ b/monkey/monkey_island/cc/resources/propagation_credentials.py @@ -29,7 +29,7 @@ class PropagationCredentials(AbstractResource): return propagation_credentials, HTTPStatus.OK def put(self, collection=None): - credentials = [Credentials.parse_raw(c) for c in request.json] + credentials = [Credentials(**c) for c in request.json] if collection == _configured_collection: self._credentials_repository.remove_configured_credentials() self._credentials_repository.save_configured_credentials(credentials)