Show tunnel info and remove config from queried node

This commit is contained in:
Itay Mizeretz 2017-09-13 18:01:41 +03:00
parent 9a9906326a
commit 5b3e526d49
1 changed files with 7 additions and 6 deletions

View File

@ -13,7 +13,7 @@ class NodeService:
@staticmethod @staticmethod
def get_displayed_node_by_id(node_id): def get_displayed_node_by_id(node_id):
if ObjectId(node_id) == ObjectId("000000000000000000000000"): if ObjectId(node_id) == NodeService.get_monkey_island_pseudo_id():
return NodeService.get_monkey_island_node() return NodeService.get_monkey_island_node()
edges = EdgeService.get_displayed_edges_by_to(node_id) edges = EdgeService.get_displayed_edges_by_to(node_id)
@ -31,8 +31,7 @@ class NodeService:
# node is infected # node is infected
new_node = NodeService.monkey_to_net_node(monkey) new_node = NodeService.monkey_to_net_node(monkey)
for key in monkey: for key in monkey:
# TODO: do something with tunnel if key not in ["_id", "modifytime", "parent", "dead", "config"]:
if key not in ["_id", "modifytime", "parent", "tunnel", "dead"]:
new_node[key] = monkey[key] new_node[key] = monkey[key]
else: else:
@ -53,8 +52,6 @@ class NodeService:
if len(edges) > 0: if len(edges) > 0:
new_node["services"] = edges[-1]["services"] new_node["services"] = edges[-1]["services"]
# TODO: add exploited by
return new_node return new_node
@staticmethod @staticmethod
@ -216,11 +213,15 @@ class NodeService:
return monkey return monkey
return None return None
@staticmethod
def get_monkey_island_pseudo_id():
return ObjectId("000000000000000000000000")
@staticmethod @staticmethod
def get_monkey_island_pseudo_net_node(): def get_monkey_island_pseudo_net_node():
return\ return\
{ {
"id": ObjectId("000000000000000000000000"), "id": NodeService.get_monkey_island_pseudo_id(),
"label": "MonkeyIsland", "label": "MonkeyIsland",
"group": "islandClean", "group": "islandClean",
} }