diff --git a/monkey/monkey_island/cc/models/monkey.py b/monkey/monkey_island/cc/models/monkey.py index a106f9965..8dfbfd48d 100644 --- a/monkey/monkey_island/cc/models/monkey.py +++ b/monkey/monkey_island/cc/models/monkey.py @@ -144,6 +144,9 @@ class Monkey(Document): """ return {"ips": self.ip_addresses, "hostname": self.hostname} + def get_tunnel_info(self): + return {"tunnel": self.tunnel} + # data has TTL of 1 second. This is useful for rapid calls for report generation. @ring.lru(expire=1) @staticmethod diff --git a/monkey/monkey_island/cc/services/attack/technique_reports/T1065.py b/monkey/monkey_island/cc/services/attack/technique_reports/T1065.py index bb71365d3..408b3a24b 100644 --- a/monkey/monkey_island/cc/services/attack/technique_reports/T1065.py +++ b/monkey/monkey_island/cc/services/attack/technique_reports/T1065.py @@ -1,4 +1,5 @@ from common.utils.attack_utils import ScanStatus +from monkey_island.cc.models.monkey import Monkey from monkey_island.cc.server_utils.consts import ISLAND_PORT from monkey_island.cc.services.attack.technique_reports import AttackTechnique @@ -13,5 +14,9 @@ class T1065(AttackTechnique): @staticmethod def get_report_data(): - T1065.used_msg = T1065.message % ISLAND_PORT + monkey = Monkey.objects.first() + tunnel = monkey.get_tunnel_info()["tunnel"] + port = tunnel.split(":")[1] if tunnel is not None else ISLAND_PORT + + T1065.used_msg = T1065.message % port return T1065.get_base_data_by_status(ScanStatus.USED.value)