diff --git a/chaos_monkey/config.py b/chaos_monkey/config.py index ff53da35b..c3767a362 100644 --- a/chaos_monkey/config.py +++ b/chaos_monkey/config.py @@ -22,8 +22,12 @@ def _cast_by_example(value, example): if example_type is str: return str(os.path.expandvars(value)) elif example_type is tuple and len(example) != 0: + if value is None or value == tuple(None): + return tuple() return tuple([_cast_by_example(x, example[0]) for x in value]) elif example_type is list and len(example) != 0: + if value is None or value == [None]: + return [] return [_cast_by_example(x, example[0]) for x in value] elif example_type is type(value): return value @@ -45,7 +49,7 @@ class Configuration(object): for key, value in data.items(): if key.startswith('_'): continue - if key in ["name", "id"]: + if key in ["name", "id", "current_server"]: continue try: default_value = getattr(Configuration, key) @@ -72,7 +76,7 @@ class Configuration(object): if val_type is types.ClassType or val_type is ABCMeta: value = value.__name__ elif val_type is tuple or val_type is list: - if len(value) != 0 and type(value[0]) is types.ClassType or type(value[0]) is ABCMeta: + if len(value) != 0 and (type(value[0]) is types.ClassType or type(value[0]) is ABCMeta): value = val_type([x.__name__ for x in value]) result[key] = value @@ -105,7 +109,7 @@ class Configuration(object): alive = True - self_delete_in_cleanup = True + self_delete_in_cleanup = False singleton_mutex_name = "{2384ec59-0df8-4ab9-918c-843740924a28}" @@ -116,8 +120,8 @@ class Configuration(object): max_iterations = 1 scanner_class = TcpScanner - finger_classes = (SMBFinger, SSHFinger, PingScanner) - exploiter_classes = (SmbExploiter, WmiExploiter, RdpExploiter, Ms08_067_Exploiter, SSHExploiter) + finger_classes = [SMBFinger, SSHFinger, PingScanner] + exploiter_classes = [SmbExploiter, WmiExploiter, RdpExploiter, Ms08_067_Exploiter, SSHExploiter] # how many victims to look for in a single scan iteration victims_max_find = 14 @@ -145,7 +149,7 @@ class Configuration(object): range_class = FixedRange range_size = 1 - range_fixed = ("", ) + range_fixed = ["", ] # TCP Scanner tcp_target_ports = [22, 2222, 445, 135, 3389] diff --git a/chaos_monkey/control.py b/chaos_monkey/control.py index d02306bb7..dc4bf198d 100644 --- a/chaos_monkey/control.py +++ b/chaos_monkey/control.py @@ -120,7 +120,7 @@ class ControlClient(object): return try: - WormConfiguration.from_dict(reply.json()["objects"][0].get('config')) + WormConfiguration.from_dict(reply.json().get('config')) LOG.info("New configuration was loaded from server: %r" % (WormConfiguration.as_dict(),)) except Exception, exc: # we don't continue with default conf here because it might be dangerous diff --git a/monkey_island/cc/admin/ui/index.html b/monkey_island/cc/admin/ui/index.html index aadd2c871..9cb253316 100644 --- a/monkey_island/cc/admin/ui/index.html +++ b/monkey_island/cc/admin/ui/index.html @@ -71,36 +71,6 @@ - -
- -
-
- Options -
-
- - -
-
- General -
-
- -
- -
- -
-
- - - -
-
-
- -
diff --git a/monkey_island/cc/admin/ui/js/monkeys-admin.js b/monkey_island/cc/admin/ui/js/monkeys-admin.js index c7f8a395f..760a5e728 100644 --- a/monkey_island/cc/admin/ui/js/monkeys-admin.js +++ b/monkey_island/cc/admin/ui/js/monkeys-admin.js @@ -187,7 +187,7 @@ function createMonkeyNode(monkey) { 'image': img, 'title': title, 'value': undefined, - 'mass': 0, + 'mass': 1, }; } @@ -202,7 +202,7 @@ function createMachineNode(machine) { 'image': img, 'title': undefined, 'value': undefined, - 'mass': 0, + 'mass': 1, }; } diff --git a/monkey_island/cc/main.py b/monkey_island/cc/main.py index c3715c018..64a92f0f9 100644 --- a/monkey_island/cc/main.py +++ b/monkey_island/cc/main.py @@ -49,8 +49,9 @@ mongo = PyMongo(app) class Monkey(restful.Resource): - def get(self, **kw): - guid = request.args.get('guid') + def get(self, guid=None, **kw): + if not guid: + guid = request.args.get('guid') timestamp = request.args.get('timestamp') if guid: