From 519f48b6d80ccebb0fa25ad04de6aed30ae6727e Mon Sep 17 00:00:00 2001 From: Kekoa Kaaikala Date: Fri, 30 Sep 2022 18:20:04 +0000 Subject: [PATCH] Island: Use ip address in scan report --- monkey/monkey_island/cc/services/reporting/report.py | 2 +- .../monkey_island/cc/services/reporting/test_report.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/monkey/monkey_island/cc/services/reporting/report.py b/monkey/monkey_island/cc/services/reporting/report.py index e0d49339a..31827a403 100644 --- a/monkey/monkey_island/cc/services/reporting/report.py +++ b/monkey/monkey_island/cc/services/reporting/report.py @@ -120,7 +120,7 @@ class ReportService: formatted_nodes.append( { "hostname": machine.hostname, - "ip_addresses": list(map(str, machine.network_interfaces)), + "ip_addresses": [str(iface.ip) for iface in machine.network_interfaces], "accessible_from_nodes": list( map(lambda m: m.dict(simplify=True), accessible_from) ), diff --git a/monkey/tests/unit_tests/monkey_island/cc/services/reporting/test_report.py b/monkey/tests/unit_tests/monkey_island/cc/services/reporting/test_report.py index 75d269701..cd38d6a6b 100644 --- a/monkey/tests/unit_tests/monkey_island/cc/services/reporting/test_report.py +++ b/monkey/tests/unit_tests/monkey_island/cc/services/reporting/test_report.py @@ -48,14 +48,14 @@ MACHINES = [MACHINE_1, MACHINE_2, MACHINE_3, ISLAND_MACHINE] EXPECTED_SCANNED_MACHINES = [ { "hostname": MACHINE_1.hostname, - "ip_addresses": list(map(str, MACHINE_1.network_interfaces)), + "ip_addresses": [str(iface.ip) for iface in MACHINE_1.network_interfaces], "accessible_from_nodes": [ISLAND_MACHINE.dict(simplify=True)], "services": [], "domain_name": "", }, { "hostname": MACHINE_2.hostname, - "ip_addresses": list(map(str, MACHINE_2.network_interfaces)), + "ip_addresses": [str(iface.ip) for iface in MACHINE_2.network_interfaces], "accessible_from_nodes": [MACHINE_1.dict(simplify=True)], "services": [], "domain_name": "",