This commit is contained in:
zandercymatics 2024-01-29 12:54:56 -07:00
parent 75e687f13b
commit acbef25ec1
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7

View file

@ -60,9 +60,10 @@ def parse_row(columns, domain_info: DomainInformation, security_emails_dict=None
else: else:
# If the dictionary doesn't contain that data, lets filter for it manually. # If the dictionary doesn't contain that data, lets filter for it manually.
# This is a last resort as this is a more expensive operation. # This is a last resort as this is a more expensive operation.
security_contacts = domain_info.domain.contacts.filter(contact_type=PublicContact.ContactTypeChoices.SECURITY) security_contacts = domain.contacts.filter(contact_type=PublicContact.ContactTypeChoices.SECURITY)
_email = security_contacts[0].email _email = security_contacts[0].email if security_contacts else None
security_email = _email if _email is not None else " " security_email = _email if _email is not None else " "
print("in else statement....")
# These are default emails that should not be displayed in the csv report # These are default emails that should not be displayed in the csv report
invalid_emails = {"registrar@dotgov.gov", "dotgov@cisa.dhs.gov"} invalid_emails = {"registrar@dotgov.gov", "dotgov@cisa.dhs.gov"}
@ -117,7 +118,7 @@ def write_body(
# Populate a dictionary of domain names and their security contacts # Populate a dictionary of domain names and their security contacts
for contact in public_contacts: for contact in public_contacts:
domain: Domain = domain_info.domain domain: Domain = contact.domain
if domain is not None and domain.name not in security_emails_dict: if domain is not None and domain.name not in security_emails_dict:
security_emails_dict[domain.name] = contact.email security_emails_dict[domain.name] = contact.email
else: else: