From 8da4c024a58d8bc606726c033ac682060b011bfe Mon Sep 17 00:00:00 2001 From: VakarisZ Date: Tue, 9 Jul 2019 18:31:47 +0300 Subject: [PATCH 1/2] Report duplicating issues bugfix --- monkey/monkey_island/cc/services/report.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/monkey/monkey_island/cc/services/report.py b/monkey/monkey_island/cc/services/report.py index 9ceb9662a..593bbfdaf 100644 --- a/monkey/monkey_island/cc/services/report.py +++ b/monkey/monkey_island/cc/services/report.py @@ -373,8 +373,13 @@ class ReportService: @staticmethod def get_exploits(): + query = [{'$match': {'telem_category': 'exploit', 'data.result': True}}, + {'$group': {'_id': {'ip_address': '$data.machine.ip_addr'}, + 'data': {'$first': '$$ROOT'}, + }}, + {"$replaceRoot": {"newRoot": "$data"}}] exploits = [] - for exploit in mongo.db.telemetry.find({'telem_category': 'exploit', 'data.result': True}): + for exploit in mongo.db.telemetry.aggregate(query): new_exploit = ReportService.process_exploit(exploit) if new_exploit not in exploits: exploits.append(new_exploit) From 8367600ab958e4ab50a0b85fdb6e9a4358fee472 Mon Sep 17 00:00:00 2001 From: VakarisZ Date: Tue, 9 Jul 2019 18:34:42 +0300 Subject: [PATCH 2/2] Tunnelling bugfix (tunnel field added to Monkey's model) --- monkey/monkey_island/cc/models/monkey.py | 1 + 1 file changed, 1 insertion(+) diff --git a/monkey/monkey_island/cc/models/monkey.py b/monkey/monkey_island/cc/models/monkey.py index 520b967a0..0b910c84b 100644 --- a/monkey/monkey_island/cc/models/monkey.py +++ b/monkey/monkey_island/cc/models/monkey.py @@ -32,6 +32,7 @@ class Monkey(Document): critical_services = ListField(StringField()) pba_results = ListField() ttl_ref = ReferenceField(MonkeyTtl) + tunnel = ReferenceField("self") # LOGIC @staticmethod