Report duplicating issues bugfix

This commit is contained in:
VakarisZ 2019-07-09 18:31:47 +03:00
parent 12e85ea2b7
commit 8da4c024a5
1 changed files with 6 additions and 1 deletions

View File

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