From 759cbcd6aeac3a2a656d11d49a2649a5c7be2466 Mon Sep 17 00:00:00 2001 From: itay Date: Mon, 18 Feb 2019 12:23:13 +0200 Subject: [PATCH] Hotfix telemetry feed accessing non-existent monkey_guid --- monkey/monkey_island/cc/resources/telemetry_feed.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/monkey/monkey_island/cc/resources/telemetry_feed.py b/monkey/monkey_island/cc/resources/telemetry_feed.py index ee9fe7e8f..deeb0f4da 100644 --- a/monkey/monkey_island/cc/resources/telemetry_feed.py +++ b/monkey/monkey_island/cc/resources/telemetry_feed.py @@ -31,11 +31,13 @@ class TelemetryFeed(flask_restful.Resource): @staticmethod def get_displayed_telemetry(telem): + monkey = NodeService.get_monkey_by_guid(telem['monkey_guid']) + default_hostname = "GUID-" + telem['monkey_guid'] return \ { 'id': telem['_id'], 'timestamp': telem['timestamp'].strftime('%d/%m/%Y %H:%M:%S'), - 'hostname': NodeService.get_monkey_by_guid(telem['monkey_guid']).get('hostname','missing'), + 'hostname': monkey.get('hostname', default_hostname) if monkey else default_hostname, 'brief': TELEM_PROCESS_DICT[telem['telem_type']](telem) }