From f6a0937b220290ff273ec05c6872990487586bff Mon Sep 17 00:00:00 2001 From: Itay Mizeretz Date: Sun, 25 Nov 2018 18:45:55 +0200 Subject: [PATCH] rename var + comment --- monkey/monkey_island/cc/services/config.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/monkey/monkey_island/cc/services/config.py b/monkey/monkey_island/cc/services/config.py index 9ebe7189c..1b2966026 100644 --- a/monkey/monkey_island/cc/services/config.py +++ b/monkey/monkey_island/cc/services/config.py @@ -1097,10 +1097,11 @@ class ConfigService: def _encrypt_or_decrypt_config(config, is_decrypt=False): for config_arr_as_array in (ENCRYPTED_CONFIG_ARRAYS + ENCRYPTED_CONFIG_STRINGS): config_arr = config - prev_config_arr = None + parent_config_arr = None + # Because the config isn't flat, this for-loop gets the actual config value out of the config for config_key_part in config_arr_as_array: - prev_config_arr = config_arr + parent_config_arr = config_arr config_arr = config_arr[config_key_part] if isinstance(config_arr, collections.Sequence) and not isinstance(config_arr, string_types): @@ -1112,7 +1113,7 @@ class ConfigService: else: config_arr[i] = encryptor.dec(config_arr[i]) if is_decrypt else encryptor.enc(config_arr[i]) else: - prev_config_arr[config_arr_as_array[-1]] =\ + parent_config_arr[config_arr_as_array[-1]] =\ encryptor.dec(config_arr) if is_decrypt else encryptor.enc(config_arr) @staticmethod