cc: resolve some flake8 warnings

This commit is contained in:
Mike Salvatore 2021-03-24 07:27:09 -04:00
parent 1fad6b4666
commit 921c4d01ca
3 changed files with 4 additions and 7 deletions

View File

@ -6,10 +6,6 @@ gevent_monkey.patch_all()
import json # noqa: E402
from monkey_island.cc.consts import (
DEFAULT_SERVER_CONFIG_PATH,
DEFAULT_LOGGER_CONFIG_PATH,
) # noqa: E402
from monkey_island.cc.island_logger import json_setup_logging # noqa: E402

View File

@ -26,6 +26,7 @@ STANDARD_WITH_CREDENTIALS = os.path.join(
WITH_DATA_DIR = os.path.join(TEST_RESOURCES_DIR, "server_config_with_data_dir.json")
WITH_DATA_DIR_HOME = os.path.join(TEST_RESOURCES_DIR, "server_config_with_data_dir_home.json")
@pytest.fixture
def config_file(tmpdir):
return os.path.join(tmpdir, "test_config.json")

View File

@ -38,7 +38,7 @@ class Encryptor:
)
def _unpad(self, message: str):
return message[0 : -ord(message[len(message) - 1])]
return message[0:-ord(message[len(message) - 1])]
def enc(self, message: str):
cipher_iv = Random.new().read(AES.block_size)
@ -49,9 +49,9 @@ class Encryptor:
def dec(self, enc_message):
enc_message = base64.b64decode(enc_message)
cipher_iv = enc_message[0 : AES.block_size]
cipher_iv = enc_message[0:AES.block_size]
cipher = AES.new(self._cipher_key, AES.MODE_CBC, cipher_iv)
return self._unpad(cipher.decrypt(enc_message[AES.block_size :]).decode())
return self._unpad(cipher.decrypt(enc_message[AES.block_size:]).decode())
def initialize_encryptor(password_file_dir):