forked from p15670423/monkey
add tunnels visualization
tunnel information is sent to island and appears on the map: blue - tunnel, red - expolit
This commit is contained in:
parent
539174e1c5
commit
347833d619
|
@ -75,6 +75,7 @@ class ChaosMonkey(object):
|
|||
|
||||
self._default_server = WormConfiguration.current_server
|
||||
LOG.debug("default server: %s" % self._default_server)
|
||||
ControlClient.send_telemetry("tunnel", ControlClient.proxies.get('https'))
|
||||
|
||||
if WormConfiguration.collect_system_info:
|
||||
LOG.debug("Calling system info collection")
|
||||
|
|
|
@ -42,9 +42,11 @@ function initAdmin() {
|
|||
nodes = [];
|
||||
edges = [];
|
||||
|
||||
createEdges();
|
||||
createTunnels();
|
||||
var data = {
|
||||
nodes: createNodes(),
|
||||
edges: createEdges()
|
||||
edges: edges
|
||||
};
|
||||
|
||||
var options = {
|
||||
|
@ -119,7 +121,9 @@ function updateMonkeys() {
|
|||
|
||||
if(new_monkeys.length > 0)
|
||||
{
|
||||
network.setData({nodes: nodes, edges: createEdges()});
|
||||
createEdges();
|
||||
createTunnels();
|
||||
network.setData({nodes: nodes, edges: edges});
|
||||
}
|
||||
|
||||
window.setTimeout(updateMonkeys, 10000);
|
||||
|
@ -173,7 +177,7 @@ function createEdges() {
|
|||
parent = getMonkeyByGuid(monkey.parent);
|
||||
|
||||
if(parent && !edgeExists([parent.id, monkey.id])) {
|
||||
edges.push({from: parent.id, to: monkey.id, arrows:'middle'});
|
||||
edges.push({from: parent.id, to: monkey.id, arrows:'middle', color: 'red'});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -181,6 +185,20 @@ function createEdges() {
|
|||
return edges;
|
||||
}
|
||||
|
||||
function createTunnels() {
|
||||
for (var i = 0; i < monkeys.length; i++) {
|
||||
var monkey = monkeys[i];
|
||||
if(monkey.tunnel_guid) {
|
||||
tunnel = getMonkeyByGuid(monkey.tunnel_guid);
|
||||
|
||||
if(tunnel && !edgeExists([monkey.id, tunnel.id])) {
|
||||
edges.push({from: monkey.id, to: tunnel.id, arrows:'middle', color:'blue'});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return edges;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds node description
|
||||
|
@ -510,8 +528,7 @@ function edgeExists(link) {
|
|||
for (var i = 0; i < edges.length; i++) {
|
||||
var from = edges[i].from;
|
||||
var to = edges[i].to;
|
||||
if ((from == link[0] && to == link[1]) ||
|
||||
(from == link[1] && to == link[0])) {
|
||||
if (from == link[0] && to == link[1]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -151,6 +151,18 @@ class Telemetry(restful.Resource):
|
|||
if 1 == len(update_parent):
|
||||
update_parent[0]['parent'] = telemetry_json['monkey_guid']
|
||||
mongo.db.monkey.update({"guid": update_parent[0]['guid']}, {"$set": update_parent[0]}, upsert=False)
|
||||
elif telemetry_json.get('telem_type') == 'tunnel':
|
||||
if telemetry_json['data']:
|
||||
host = telemetry_json['data'].split(":")[-2].replace("//", "")
|
||||
tunnel_host = mongo.db.monkey.find_one({"ip_addresses": host})
|
||||
mongo.db.monkey.update({"guid": telemetry_json['monkey_guid']},
|
||||
{'$set': {'tunnel_guid': tunnel_host.get('guid')}},
|
||||
upsert=True)
|
||||
else:
|
||||
mongo.db.monkey.update({"guid": telemetry_json['monkey_guid']},
|
||||
{'$unset': {'tunnel_guid':''}},
|
||||
upsert=True)
|
||||
|
||||
except:
|
||||
pass
|
||||
|
||||
|
|
Loading…
Reference in New Issue