punk-security/dnsReaper

AWS Provider: Alias records don't contain ResourceRecords

parkeyparker opened this issue · 0 comments

When using the AWS provider to get all domains from Route53 there may be some Alias records in there (eg for CloudFront) and those records don't contain ResourceRecords causing an error to be thrown:

Traceback (most recent call last):
  File "dnsReaper/main.py", line 49, in <module>
    domains = provider.fetch_domains(**args.__dict__)
  File "dnsReaper/providers/aws.py", line 63, in fetch_domains
    for domain in convert_records_to_domains(records):
  File "dnsReaper/providers/aws.py", line 25, in convert_records_to_domains
    r["Value"] for r in record["ResourceRecords"]
KeyError: 'ResourceRecords'

One solution is to update lines 23-25 in aws.py to be:

if "ResourceRecords" in record:
    buf[record["Name"]][record["Type"]] = [
        r["Value"] for r in record["ResourceRecords"]
    ]

Will raise PR shortly...