Island: Use tunnel or island port in T1065

* adds get_tunnel_info in monkey model
This commit is contained in:
Ilija Lazoroski 2022-06-14 15:57:28 +02:00 committed by vakarisz
parent ed3c369eef
commit 136747b1c8
2 changed files with 9 additions and 1 deletions

View File

@ -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

View File

@ -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)