Skip to content

Commit

Permalink
cc: resolve some flake8 errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mssalvatore committed Mar 24, 2021
1 parent 7b51b3f commit 22f9ca9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions monkey/monkey_island/cc/encryptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def _pad(self, message):
)

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)
Expand All @@ -48,9 +48,9 @@ def enc(self, message: str):

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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
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")
Expand Down

0 comments on commit 22f9ca9

Please sign in to comment.