Island: Use relative imports inside encryption package

This commit is contained in:
Mike Salvatore 2021-10-04 13:59:06 -04:00
parent f65251ddde
commit 5aa0506ce1
8 changed files with 15 additions and 22 deletions

View File

@ -3,13 +3,10 @@ from typing import Union
from Crypto import Random # noqa: DUO133 # nosec: B413 from Crypto import Random # noqa: DUO133 # nosec: B413
from monkey_island.cc.server_utils.encryption import (
IEncryptor,
KeyBasedEncryptor,
PasswordBasedBytesEncryptor,
)
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
_KEY_FILENAME = "mongo_key.bin" _KEY_FILENAME = "mongo_key.bin"
_BLOCK_SIZE = 32 _BLOCK_SIZE = 32

View File

@ -3,9 +3,7 @@ from typing import Callable, List, Type
import dpath.util import dpath.util
from monkey_island.cc.server_utils.encryption.dict_encryption.field_encryptors import ( from .field_encryptors import IFieldEncryptor
IFieldEncryptor,
)
class FieldNotFoundError(Exception): class FieldNotFoundError(Exception):

View File

@ -1,9 +1,7 @@
import logging import logging
from monkey_island.cc.server_utils.encryption import get_datastore_encryptor from ... import get_datastore_encryptor
from monkey_island.cc.server_utils.encryption.dict_encryption.field_encryptors import ( from . import IFieldEncryptor
IFieldEncryptor,
)
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@ -1,9 +1,7 @@
from typing import List from typing import List
from monkey_island.cc.server_utils.encryption import get_datastore_encryptor from ... import get_datastore_encryptor
from monkey_island.cc.server_utils.encryption.dict_encryption.field_encryptors import ( from . import IFieldEncryptor
IFieldEncryptor,
)
class StringListEncryptor(IFieldEncryptor): class StringListEncryptor(IFieldEncryptor):

View File

@ -0,0 +1,4 @@
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

@ -7,7 +7,7 @@ from Crypto import Random # noqa: DUO133 # nosec: B413
from Crypto.Cipher import AES # noqa: DUO133 # nosec: B413 from Crypto.Cipher import AES # noqa: DUO133 # nosec: B413
from Crypto.Util import Padding # noqa: DUO133 from Crypto.Util import Padding # noqa: DUO133
from monkey_island.cc.server_utils.encryption import IEncryptor from .i_encryptor import IEncryptor
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@ -3,7 +3,7 @@ import logging
import pyAesCrypt import pyAesCrypt
from monkey_island.cc.server_utils.encryption import IEncryptor from .i_encryptor import IEncryptor
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@ -3,10 +3,8 @@ import logging
import pyAesCrypt import pyAesCrypt
from monkey_island.cc.server_utils.encryption import IEncryptor from .i_encryptor import IEncryptor
from monkey_island.cc.server_utils.encryption.encryptors.password_based_bytes_encryptor import ( from .password_based_bytes_encryptor import PasswordBasedBytesEncryptor
PasswordBasedBytesEncryptor,
)
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)