From 34d065ce698824edb4d51e2dd7c520733e6b00f6 Mon Sep 17 00:00:00 2001 From: VakarisZ Date: Mon, 4 Oct 2021 09:29:40 +0300 Subject: [PATCH] Move encryptors into a separate folder This separates encryptor classes from other encryption related infrastructure that we have cc\server_utils\encryption --- .../cc/server_utils/encryption/__init__.py | 19 +++++++++---------- .../encryption/encryptors/__init__.py | 0 .../{ => encryptors}/i_encryptor.py | 0 .../{ => encryptors}/key_based_encryptor.py | 0 .../password_based_bytes_encryption.py | 0 .../password_based_string_encryptior.py | 2 +- 6 files changed, 10 insertions(+), 11 deletions(-) create mode 100644 monkey/monkey_island/cc/server_utils/encryption/encryptors/__init__.py rename monkey/monkey_island/cc/server_utils/encryption/{ => encryptors}/i_encryptor.py (100%) rename monkey/monkey_island/cc/server_utils/encryption/{ => encryptors}/key_based_encryptor.py (100%) rename monkey/monkey_island/cc/server_utils/encryption/{ => encryptors}/password_based_bytes_encryption.py (100%) rename monkey/monkey_island/cc/server_utils/encryption/{ => encryptors}/password_based_string_encryptior.py (90%) diff --git a/monkey/monkey_island/cc/server_utils/encryption/__init__.py b/monkey/monkey_island/cc/server_utils/encryption/__init__.py index 1c3e422db..ea04a25e1 100644 --- a/monkey/monkey_island/cc/server_utils/encryption/__init__.py +++ b/monkey/monkey_island/cc/server_utils/encryption/__init__.py @@ -1,18 +1,17 @@ -from monkey_island.cc.server_utils.encryption.i_encryptor import IEncryptor -from monkey_island.cc.server_utils.encryption.key_based_encryptor import KeyBasedEncryptor -from monkey_island.cc.server_utils.encryption.password_based_string_encryptior import ( +from monkey_island.cc.server_utils.encryption.encryptors.i_encryptor import IEncryptor +from monkey_island.cc.server_utils.encryption.encryptors.key_based_encryptor import ( + KeyBasedEncryptor, +) +from monkey_island.cc.server_utils.encryption.encryptors.password_based_string_encryptior import ( PasswordBasedStringEncryptor, is_encrypted, ) -from .encryptor_factory import ( - FactoryNotInitializedError, - remove_old_datastore_key, - get_encryptor_factory, - _get_secret_from_credentials, - initialize_encryptor_factory, +from monkey_island.cc.server_utils.encryption.encryptors.password_based_bytes_encryption import ( + PasswordBasedBytesEncryptor, + InvalidCredentialsError, + InvalidCiphertextError, ) from .data_store_encryptor import initialize_datastore_encryptor, get_datastore_encryptor -from .password_based_bytes_encryption import InvalidCredentialsError, InvalidCiphertextError from .dict_encryption.dict_encryptor import ( SensitiveField, encrypt_dict, diff --git a/monkey/monkey_island/cc/server_utils/encryption/encryptors/__init__.py b/monkey/monkey_island/cc/server_utils/encryption/encryptors/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/monkey/monkey_island/cc/server_utils/encryption/i_encryptor.py b/monkey/monkey_island/cc/server_utils/encryption/encryptors/i_encryptor.py similarity index 100% rename from monkey/monkey_island/cc/server_utils/encryption/i_encryptor.py rename to monkey/monkey_island/cc/server_utils/encryption/encryptors/i_encryptor.py diff --git a/monkey/monkey_island/cc/server_utils/encryption/key_based_encryptor.py b/monkey/monkey_island/cc/server_utils/encryption/encryptors/key_based_encryptor.py similarity index 100% rename from monkey/monkey_island/cc/server_utils/encryption/key_based_encryptor.py rename to monkey/monkey_island/cc/server_utils/encryption/encryptors/key_based_encryptor.py diff --git a/monkey/monkey_island/cc/server_utils/encryption/password_based_bytes_encryption.py b/monkey/monkey_island/cc/server_utils/encryption/encryptors/password_based_bytes_encryption.py similarity index 100% rename from monkey/monkey_island/cc/server_utils/encryption/password_based_bytes_encryption.py rename to monkey/monkey_island/cc/server_utils/encryption/encryptors/password_based_bytes_encryption.py diff --git a/monkey/monkey_island/cc/server_utils/encryption/password_based_string_encryptior.py b/monkey/monkey_island/cc/server_utils/encryption/encryptors/password_based_string_encryptior.py similarity index 90% rename from monkey/monkey_island/cc/server_utils/encryption/password_based_string_encryptior.py rename to monkey/monkey_island/cc/server_utils/encryption/encryptors/password_based_string_encryptior.py index 716455a5b..9f99f735b 100644 --- a/monkey/monkey_island/cc/server_utils/encryption/password_based_string_encryptior.py +++ b/monkey/monkey_island/cc/server_utils/encryption/encryptors/password_based_string_encryptior.py @@ -4,7 +4,7 @@ import logging import pyAesCrypt from monkey_island.cc.server_utils.encryption import IEncryptor -from monkey_island.cc.server_utils.encryption.password_based_bytes_encryption import ( +from monkey_island.cc.server_utils.encryption.encryptors.password_based_bytes_encryption import ( PasswordBasedBytesEncryptor, )