From 1b45029c5d30f4d52b99d1efa29679b6f9e7f5e4 Mon Sep 17 00:00:00 2001 From: "maor.rayzin" Date: Sat, 21 Jul 2018 21:13:42 +0300 Subject: [PATCH] * WIP added map edges and nodes generation --- monkey_island/cc/services/pth_report.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/monkey_island/cc/services/pth_report.py b/monkey_island/cc/services/pth_report.py index 3f01839f3..bc7cf9055 100644 --- a/monkey_island/cc/services/pth_report.py +++ b/monkey_island/cc/services/pth_report.py @@ -1,4 +1,4 @@ -from cc.services.pth_report_utils import PassTheHashReport +from cc.services.pth_report_utils import PassTheHashReport, Machine class PTHReportService(object): @@ -106,6 +106,14 @@ class PTHReportService(object): strong_users_non_crit_list.append(machine) return strong_users_non_crit_list + @staticmethod + def generate_map_nodes(pth): + return [{"id": x, "label": Machine(x).GetIp()} for x in pth.vertices] + + @staticmethod + def generate_map_edges(pth): + return [{"id": str(s) + str(t), "from": s, "to": t, "label": label} for s, t, label in pth.edges] + @staticmethod def get_report(): pth = PassTheHashReport() @@ -121,7 +129,8 @@ class PTHReportService(object): }, 'map': { - + 'nodes': PTHReportService.generate_map_nodes(pth), + 'edges': PTHReportService.generate_map_edges(pth) } } return report