diff --git a/monkey/common/cloud/aws_instance.py b/monkey/common/cloud/aws_instance.py index 0aece9bcc..cba1f3670 100644 --- a/monkey/common/cloud/aws_instance.py +++ b/monkey/common/cloud/aws_instance.py @@ -30,14 +30,14 @@ class AwsInstance(object): self.region = self._parse_region( urllib.request.urlopen(AWS_LATEST_METADATA_URI_PREFIX + 'meta-data/placement/availability-zone').read()) except urllib.error.URLError as e: - logger.warning("Failed init of AwsInstance while getting metadata: {}".format(e.message)) + logger.warning("Failed init of AwsInstance while getting metadata: {}".format(e)) try: self.account_id = self._extract_account_id( urllib.request.urlopen( AWS_LATEST_METADATA_URI_PREFIX + 'dynamic/instance-identity/document', timeout=2).read()) except urllib.error.URLError as e: - logger.warning("Failed init of AwsInstance while getting dynamic instance data: {}".format(e.message)) + logger.warning("Failed init of AwsInstance while getting dynamic instance data: {}".format(e)) @staticmethod def _parse_region(region_url_response): diff --git a/monkey/infection_monkey.py b/monkey/infection_monkey.py index 7059088c9..a63dec069 100644 --- a/monkey/infection_monkey.py +++ b/monkey/infection_monkey.py @@ -1,4 +1,4 @@ -from . import infection_monkey.main +from infection_monkey.main import main if "__main__" == __name__: - infection_monkey.main.main() + main() diff --git a/monkey/monkey_island/cc/encryptor.py b/monkey/monkey_island/cc/encryptor.py index 98473b60a..d727fe10c 100644 --- a/monkey/monkey_island/cc/encryptor.py +++ b/monkey/monkey_island/cc/encryptor.py @@ -41,7 +41,7 @@ class Encryptor: def enc(self, message): cipher_iv = Random.new().read(AES.block_size) cipher = AES.new(self._cipher_key, AES.MODE_CBC, cipher_iv) - return base64.b64encode(cipher_iv + cipher.encrypt(str(self._pad(message)))) # ciper.encrypt expects str + return base64.b64encode(cipher_iv + cipher.encrypt(self._pad(message).encode())) def dec(self, enc_message): enc_message = base64.b64decode(enc_message) diff --git a/monkey/monkey_island/cc/environment/__init__.py b/monkey/monkey_island/cc/environment/__init__.py index 0115cf446..4d125e98c 100644 --- a/monkey/monkey_island/cc/environment/__init__.py +++ b/monkey/monkey_island/cc/environment/__init__.py @@ -1,4 +1,4 @@ -import abc +from abc import ABCMeta, abstractmethod from datetime import timedelta import os from Crypto.Hash import SHA3_512 @@ -6,7 +6,7 @@ from Crypto.Hash import SHA3_512 __author__ = 'itay.mizeretz' -class Environment(object, metaclass=abc.ABCMeta): +class Environment(object, metaclass=ABCMeta): _ISLAND_PORT = 5000 _MONGO_DB_NAME = "monkeyisland" _MONGO_DB_HOST = "localhost" @@ -67,7 +67,7 @@ class Environment(object, metaclass=abc.ABCMeta): val = self.config.get(key, val) return val - @abc.abstractmethod + @abstractmethod def get_auth_users(self): return