forked from p15670423/monkey
Hotfix to monkey island pseudo edges
This commit is contained in:
parent
1efbadcacd
commit
5e133b78f3
|
@ -88,7 +88,7 @@ class Telemetry(flask_restful.Resource):
|
||||||
|
|
||||||
def process_tunnel_telemetry(self, telemetry_json):
|
def process_tunnel_telemetry(self, telemetry_json):
|
||||||
monkey_id = NodeService.get_monkey_by_guid(telemetry_json['monkey_guid'])["_id"]
|
monkey_id = NodeService.get_monkey_by_guid(telemetry_json['monkey_guid'])["_id"]
|
||||||
if telemetry_json['data'] is not None:
|
if telemetry_json['data']['proxy'] is not None:
|
||||||
host = telemetry_json['data']['proxy'].split(":")[-2].replace("//", "")
|
host = telemetry_json['data']['proxy'].split(":")[-2].replace("//", "")
|
||||||
tunnel_host_id = NodeService.get_monkey_by_ip(host)["_id"]
|
tunnel_host_id = NodeService.get_monkey_by_ip(host)["_id"]
|
||||||
NodeService.set_monkey_tunnel(monkey_id, tunnel_host_id)
|
NodeService.set_monkey_tunnel(monkey_id, tunnel_host_id)
|
||||||
|
|
|
@ -184,11 +184,14 @@ class EdgeService:
|
||||||
def get_edge_label(edge):
|
def get_edge_label(edge):
|
||||||
NodeService = cc.services.node.NodeService
|
NodeService = cc.services.node.NodeService
|
||||||
from_label = NodeService.get_monkey_label(NodeService.get_monkey_by_id(edge["from"]))
|
from_label = NodeService.get_monkey_label(NodeService.get_monkey_by_id(edge["from"]))
|
||||||
to_id = NodeService.get_monkey_by_id(edge["to"])
|
if edge["to"] == ObjectId("000000000000000000000000"):
|
||||||
if to_id is None:
|
to_label = 'MonkeyIsland'
|
||||||
to_label = NodeService.get_node_label(NodeService.get_node_by_id(edge["to"]))
|
|
||||||
else:
|
else:
|
||||||
to_label = NodeService.get_monkey_label(to_id)
|
to_id = NodeService.get_monkey_by_id(edge["to"])
|
||||||
|
if to_id is None:
|
||||||
|
to_label = NodeService.get_node_label(NodeService.get_node_by_id(edge["to"]))
|
||||||
|
else:
|
||||||
|
to_label = NodeService.get_monkey_label(to_id)
|
||||||
|
|
||||||
RIGHT_ARROW = u"\u2192"
|
RIGHT_ARROW = u"\u2192"
|
||||||
return "%s %s %s" % (from_label, RIGHT_ARROW, to_label)
|
return "%s %s %s" % (from_label, RIGHT_ARROW, to_label)
|
||||||
|
|
Loading…
Reference in New Issue