Fixing some string formatting in island
This commit is contained in:
parent
81fb8adc02
commit
e0463b6b12
|
@ -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):
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from . import infection_monkey.main
|
||||
from infection_monkey.main import main
|
||||
|
||||
if "__main__" == __name__:
|
||||
infection_monkey.main.main()
|
||||
main()
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue