Island: Flatten directory structure for "encryption" package

This commit is contained in:
Mike Salvatore 2021-10-05 12:37:05 -04:00
parent bf082d36ef
commit 0eafc6613a
15 changed files with 15 additions and 21 deletions

View File

@ -1,12 +1,12 @@
from monkey_island.cc.server_utils.encryption.encryptors.i_encryptor import IEncryptor from .i_encryptor import IEncryptor
from monkey_island.cc.server_utils.encryption.encryptors.key_based_encryptor import ( from .key_based_encryptor import (
KeyBasedEncryptor, KeyBasedEncryptor,
) )
from monkey_island.cc.server_utils.encryption.encryptors.password_based_string_encryptor import ( from .password_based_string_encryptor import (
PasswordBasedStringEncryptor, PasswordBasedStringEncryptor,
is_encrypted, is_encrypted,
) )
from monkey_island.cc.server_utils.encryption.encryptors.password_based_bytes_encryptor import ( from .password_based_bytes_encryptor import (
PasswordBasedBytesEncryptor, PasswordBasedBytesEncryptor,
InvalidCredentialsError, InvalidCredentialsError,
InvalidCiphertextError, InvalidCiphertextError,
@ -16,11 +16,12 @@ from .data_store_encryptor import (
get_datastore_encryptor, get_datastore_encryptor,
remove_old_datastore_key, remove_old_datastore_key,
) )
from .dict_encryption.dict_encryptor import ( from .dict_encryptor import (
SensitiveField, SensitiveField,
encrypt_dict, encrypt_dict,
decrypt_dict, decrypt_dict,
FieldNotFoundError, FieldNotFoundError,
) )
from .dict_encryption.field_encryptors.mimikatz_results_encryptor import MimikatzResultsEncryptor from .field_encryptors.i_field_encryptor import IFieldEncryptor
from .dict_encryption.field_encryptors.string_list_encryptor import StringListEncryptor from .field_encryptors.mimikatz_results_encryptor import MimikatzResultsEncryptor
from .field_encryptors.string_list_encryptor import StringListEncryptor

View File

@ -5,7 +5,9 @@ from Crypto import Random # noqa: DUO133 # nosec: B413
from monkey_island.cc.server_utils.file_utils import open_new_securely_permissioned_file from monkey_island.cc.server_utils.file_utils import open_new_securely_permissioned_file
from .encryptors import IEncryptor, KeyBasedEncryptor, PasswordBasedBytesEncryptor from .i_encryptor import IEncryptor
from .key_based_encryptor import KeyBasedEncryptor
from .password_based_bytes_encryptor import PasswordBasedBytesEncryptor
_KEY_FILENAME = "mongo_key.bin" _KEY_FILENAME = "mongo_key.bin"
_BLOCK_SIZE = 32 _BLOCK_SIZE = 32

View File

@ -1,4 +0,0 @@
from .i_encryptor import IEncryptor
from .key_based_encryptor import KeyBasedEncryptor
from .password_based_string_encryptor import PasswordBasedStringEncryptor
from .password_based_bytes_encryptor import PasswordBasedBytesEncryptor

View File

@ -1,6 +1,6 @@
import logging import logging
from ... import get_datastore_encryptor from ..data_store_encryptor import get_datastore_encryptor
from . import IFieldEncryptor from . import IFieldEncryptor
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@ -1,6 +1,6 @@
from typing import List from typing import List
from ... import get_datastore_encryptor from ..data_store_encryptor import get_datastore_encryptor
from . import IFieldEncryptor from . import IFieldEncryptor

View File

@ -5,10 +5,7 @@ import pytest
from monkey_island.cc.models import Report from monkey_island.cc.models import Report
from monkey_island.cc.models.report import get_report, save_report from monkey_island.cc.models.report import get_report, save_report
from monkey_island.cc.server_utils.encryption import SensitiveField from monkey_island.cc.server_utils.encryption import IFieldEncryptor, SensitiveField
from monkey_island.cc.server_utils.encryption.dict_encryption.field_encryptors import (
IFieldEncryptor,
)
MOCK_SENSITIVE_FIELD_CONTENTS = ["the_string", "the_string2"] MOCK_SENSITIVE_FIELD_CONTENTS = ["the_string", "the_string2"]
MOCK_REPORT_DICT = { MOCK_REPORT_DICT = {

View File

@ -1,8 +1,6 @@
import pytest import pytest
from monkey_island.cc.server_utils.encryption.dict_encryption.field_encryptors import ( from monkey_island.cc.server_utils.encryption import StringListEncryptor
StringListEncryptor,
)
MOCK_STRING_LIST = ["test_1", "test_2"] MOCK_STRING_LIST = ["test_1", "test_2"]
EMPTY_LIST = [] EMPTY_LIST = []