forked from p15670423/monkey
serval bug fixes
1. all monkeys got the 1st config; 2. incompatible config types 3. UI fixes at the island
This commit is contained in:
parent
3d5d972cf8
commit
5d1a3680b2
|
@ -22,8 +22,12 @@ def _cast_by_example(value, example):
|
||||||
if example_type is str:
|
if example_type is str:
|
||||||
return str(os.path.expandvars(value))
|
return str(os.path.expandvars(value))
|
||||||
elif example_type is tuple and len(example) != 0:
|
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])
|
return tuple([_cast_by_example(x, example[0]) for x in value])
|
||||||
elif example_type is list and len(example) != 0:
|
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]
|
return [_cast_by_example(x, example[0]) for x in value]
|
||||||
elif example_type is type(value):
|
elif example_type is type(value):
|
||||||
return value
|
return value
|
||||||
|
@ -45,7 +49,7 @@ class Configuration(object):
|
||||||
for key, value in data.items():
|
for key, value in data.items():
|
||||||
if key.startswith('_'):
|
if key.startswith('_'):
|
||||||
continue
|
continue
|
||||||
if key in ["name", "id"]:
|
if key in ["name", "id", "current_server"]:
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
default_value = getattr(Configuration, key)
|
default_value = getattr(Configuration, key)
|
||||||
|
@ -72,7 +76,7 @@ class Configuration(object):
|
||||||
if val_type is types.ClassType or val_type is ABCMeta:
|
if val_type is types.ClassType or val_type is ABCMeta:
|
||||||
value = value.__name__
|
value = value.__name__
|
||||||
elif val_type is tuple or val_type is list:
|
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])
|
value = val_type([x.__name__ for x in value])
|
||||||
|
|
||||||
result[key] = value
|
result[key] = value
|
||||||
|
@ -105,7 +109,7 @@ class Configuration(object):
|
||||||
|
|
||||||
alive = True
|
alive = True
|
||||||
|
|
||||||
self_delete_in_cleanup = True
|
self_delete_in_cleanup = False
|
||||||
|
|
||||||
singleton_mutex_name = "{2384ec59-0df8-4ab9-918c-843740924a28}"
|
singleton_mutex_name = "{2384ec59-0df8-4ab9-918c-843740924a28}"
|
||||||
|
|
||||||
|
@ -116,8 +120,8 @@ class Configuration(object):
|
||||||
max_iterations = 1
|
max_iterations = 1
|
||||||
|
|
||||||
scanner_class = TcpScanner
|
scanner_class = TcpScanner
|
||||||
finger_classes = (SMBFinger, SSHFinger, PingScanner)
|
finger_classes = [SMBFinger, SSHFinger, PingScanner]
|
||||||
exploiter_classes = (SmbExploiter, WmiExploiter, RdpExploiter, Ms08_067_Exploiter, SSHExploiter)
|
exploiter_classes = [SmbExploiter, WmiExploiter, RdpExploiter, Ms08_067_Exploiter, SSHExploiter]
|
||||||
|
|
||||||
# how many victims to look for in a single scan iteration
|
# how many victims to look for in a single scan iteration
|
||||||
victims_max_find = 14
|
victims_max_find = 14
|
||||||
|
@ -145,7 +149,7 @@ class Configuration(object):
|
||||||
|
|
||||||
range_class = FixedRange
|
range_class = FixedRange
|
||||||
range_size = 1
|
range_size = 1
|
||||||
range_fixed = ("", )
|
range_fixed = ["", ]
|
||||||
|
|
||||||
# TCP Scanner
|
# TCP Scanner
|
||||||
tcp_target_ports = [22, 2222, 445, 135, 3389]
|
tcp_target_ports = [22, 2222, 445, 135, 3389]
|
||||||
|
|
|
@ -120,7 +120,7 @@ class ControlClient(object):
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
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(),))
|
LOG.info("New configuration was loaded from server: %r" % (WormConfiguration.as_dict(),))
|
||||||
except Exception, exc:
|
except Exception, exc:
|
||||||
# we don't continue with default conf here because it might be dangerous
|
# we don't continue with default conf here because it might be dangerous
|
||||||
|
|
|
@ -71,36 +71,6 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- /.Network section -->
|
<!-- /.Network section -->
|
||||||
|
|
||||||
<!-- Options section -->
|
|
||||||
<div class="col-lg-3 col-md-6 col-sm-6">
|
|
||||||
|
|
||||||
<div class="panel panel-default">
|
|
||||||
<div class="panel-heading">
|
|
||||||
<a href="#options" data-toggle="collapse">Options</a>
|
|
||||||
</div>
|
|
||||||
<div id="options" class="panel-body panel-collapse collapse">
|
|
||||||
|
|
||||||
<!-- General options -->
|
|
||||||
<div class="panel panel-default">
|
|
||||||
<div class="panel-heading">
|
|
||||||
<a href="#general" data-toggle="collapse">General</a>
|
|
||||||
</div>
|
|
||||||
<div id="general" class="panel-body panel-collapse collapse in">
|
|
||||||
|
|
||||||
<div id="options-feedback">
|
|
||||||
<!-- Notifications goes here -->
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- /.General options -->
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- /.Options section -->
|
|
||||||
|
|
||||||
<!-- Details section -->
|
<!-- Details section -->
|
||||||
<div class="col-lg-3 col-md-6 col-sm-6">
|
<div class="col-lg-3 col-md-6 col-sm-6">
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
|
|
|
@ -187,7 +187,7 @@ function createMonkeyNode(monkey) {
|
||||||
'image': img,
|
'image': img,
|
||||||
'title': title,
|
'title': title,
|
||||||
'value': undefined,
|
'value': undefined,
|
||||||
'mass': 0,
|
'mass': 1,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ function createMachineNode(machine) {
|
||||||
'image': img,
|
'image': img,
|
||||||
'title': undefined,
|
'title': undefined,
|
||||||
'value': undefined,
|
'value': undefined,
|
||||||
'mass': 0,
|
'mass': 1,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,8 +49,9 @@ mongo = PyMongo(app)
|
||||||
|
|
||||||
|
|
||||||
class Monkey(restful.Resource):
|
class Monkey(restful.Resource):
|
||||||
def get(self, **kw):
|
def get(self, guid=None, **kw):
|
||||||
guid = request.args.get('guid')
|
if not guid:
|
||||||
|
guid = request.args.get('guid')
|
||||||
timestamp = request.args.get('timestamp')
|
timestamp = request.args.get('timestamp')
|
||||||
|
|
||||||
if guid:
|
if guid:
|
||||||
|
|
Loading…
Reference in New Issue