Fixed a bug in report backend

This commit is contained in:
VakarisZ 2021-03-29 17:41:23 +03:00
parent abb7ab09a9
commit 280df4e676
1 changed files with 3 additions and 2 deletions

View File

@ -264,7 +264,7 @@ class ReportService:
return exploiter_info return exploiter_info
@staticmethod @staticmethod
def get_exploits(): def get_exploits() -> dict:
query = [{'$match': {'telem_category': 'exploit', 'data.result': True}}, query = [{'$match': {'telem_category': 'exploit', 'data.result': True}},
{'$group': {'_id': {'ip_address': '$data.machine.ip_addr'}, {'$group': {'_id': {'ip_address': '$data.machine.ip_addr'},
'data': {'$first': '$$ROOT'}, 'data': {'$first': '$$ROOT'},
@ -274,7 +274,7 @@ class ReportService:
for exploit in mongo.db.telemetry.aggregate(query): for exploit in mongo.db.telemetry.aggregate(query):
new_exploit = ReportService.process_exploit(exploit) new_exploit = ReportService.process_exploit(exploit)
if new_exploit not in exploits: if new_exploit not in exploits:
exploits.append(new_exploit) exploits.append(new_exploit.__dict__)
return exploits return exploits
@staticmethod @staticmethod
@ -594,6 +594,7 @@ class ReportService:
@staticmethod @staticmethod
def get_issues(): def get_issues():
# Todo refactor these into separate files with a method signature -> dict
ISSUE_GENERATORS = [ ISSUE_GENERATORS = [
ReportService.get_exploits, ReportService.get_exploits,
ReportService.get_tunnels, ReportService.get_tunnels,