Show IP if domain name isn't available

This commit is contained in:
Shreya 2021-02-27 01:04:52 +05:30
parent 1528b00a1b
commit 8d2e530eaa
1 changed files with 4 additions and 2 deletions

View File

@ -206,9 +206,11 @@ class ReportService:
def _get_credentials_from_exploit_telems():
formatted_creds = []
for telem in mongo.db.telemetry.find({'telem_category': 'exploit', 'data.info.credentials': {'$exists': True}},
{'data.info.credentials': 1, 'monkey_guid': 1}):
{'data.info.credentials': 1, 'data.machine': 1, 'monkey_guid': 1}):
creds = telem['data']['info']['credentials']
origin = telem['data']['machine']['domain_name']
_domain_name = telem['data']['machine']['domain_name']
_ip = telem['data']['machine']['ip_addr']
origin = _domain_name if _domain_name else _ip
formatted_creds.extend(ReportService._format_creds_for_reporting(telem, creds, origin))
return formatted_creds