Skip to content

Commit

Permalink
Fix if base_domain is None before get_service_from_reverse_dns_base_d… (
Browse files Browse the repository at this point in the history
#514)

* Fix if base_domain is None before get_service_from_reverse_dns_base_domain call

- Added if statement for base_domain before getting get_service_from_reverse_dns_base_domain(). If base_domain is None, get_service_from_reverse_dns_base_domain() will fail the report.
- Added .xml test file

* Create protection.outlook.com!example.com!1711756800!1711843200.xml

added .xml test sample report where base_domain return none
  • Loading branch information
Kuzuto authored May 22, 2024
1 parent 42be533 commit 91191e3
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 10 deletions.
21 changes: 11 additions & 10 deletions parsedmarc/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,16 +403,17 @@ def get_ip_address_info(ip_address,
info["type"] = None
if reverse_dns is not None:
base_domain = get_base_domain(reverse_dns)
service = get_service_from_reverse_dns_base_domain(
base_domain,
offline=offline,
local_file_path=reverse_dns_map_path,
url=reverse_dns_map_url,
always_use_local_file=always_use_local_files,
reverse_dns_map=reverse_dns_map)
info["base_domain"] = base_domain
info["type"] = service["type"]
info["name"] = service["name"]
if base_domain is not None:
service = get_service_from_reverse_dns_base_domain(
base_domain,
offline=offline,
local_file_path=reverse_dns_map_path,
url=reverse_dns_map_url,
always_use_local_file=always_use_local_files,
reverse_dns_map=reverse_dns_map)
info["base_domain"] = base_domain
info["type"] = service["type"]
info["name"] = service["name"]

if cache is not None:
cache[ip_address] = info
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?xml version="1.0"?>
<feedback xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<version>1.0</version>
<report_metadata>
<org_name>Outlook.com</org_name>
<email>[email protected]</email>
<report_id>cfeafefe4129445e8c81018bd9177197</report_id>
<date_range>
<begin>1711756800</begin>
<end>1711843200</end>
</date_range>
</report_metadata>
<policy_published>
<domain>example.com</domain>
<adkim>r</adkim>
<aspf>r</aspf>
<p>none</p>
<sp>none</sp>
<pct>100</pct>
<fo>0</fo>
</policy_published>
<record>
<row>
<source_ip>100.24.188.149</source_ip>
<count>1</count>
<policy_evaluated>
<disposition>none</disposition>
<dkim>fail</dkim>
<spf>fail</spf>
</policy_evaluated>
</row>
<identifiers>
<envelope_to>hotmail.com</envelope_to>
<envelope_from>example.com</envelope_from>
<header_from>example.com</header_from>
</identifiers>
<auth_results>
<spf>
<domain>example.com</domain>
<scope>mfrom</scope>
<result>fail</result>
</spf>
</auth_results>
</record>
</feedback>

0 comments on commit 91191e3

Please sign in to comment.