diff --git a/.gitignore b/.gitignore index 665b00da..9b845e18 100644 --- a/.gitignore +++ b/.gitignore @@ -127,3 +127,5 @@ tmp/ prod*.ini stage*.ini dev*.ini + +*.mmdb diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b0375a2..7187fcd1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +6.4.2 +----- + +- Do not attempt to convert `org_name` to a base domain if `org_name` contains + a space (closes issue #94) +- Always lowercase the `header_from` +- Provide a more helpful warning message when `GeoLite2-Country.mmdb` is + missing + 6.4.1 ----- diff --git a/docs/index.rst b/docs/index.rst index cde4148b..a34b0305 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -475,6 +475,7 @@ On Debian or Ubuntu systems, run: .. code-block:: bash sudo apt-get install -y python3-pip geoipupdate + sudo geoipupdate On CentOS systems, run: diff --git a/parsedmarc/__init__.py b/parsedmarc/__init__.py index 8656ba01..9edb68ff 100644 --- a/parsedmarc/__init__.py +++ b/parsedmarc/__init__.py @@ -38,7 +38,7 @@ from parsedmarc.utils import is_outlook_msg, convert_outlook_msg from parsedmarc.utils import timestamp_to_human, human_timestamp_to_datetime from parsedmarc.utils import parse_email -__version__ = "6.4.1" +__version__ = "6.4.2" logging.basicConfig( format='%(levelname)8s:%(filename)s:%(lineno)d:' @@ -145,6 +145,8 @@ def _parse_report_record(record, nameservers=None, dns_timeout=2.0, new_record["policy_evaluated"] = new_policy_evaluated new_record["identifiers"] = record["identifiers"].copy() new_record["auth_results"] = OrderedDict([("dkim", []), ("spf", [])]) + lowered_from = new_record["identifiers"]["header_from"].lower() + new_record["identifiers"]["header_from"] = lowered_from if record["auth_results"] is not None: auth_results = record["auth_results"].copy() if "spf" not in auth_results: @@ -248,7 +250,7 @@ def parse_aggregate_report_xml(xml, nameservers=None, timeout=2.0, report_metadata["org_name"] = report_metadata[ "email"].split("@")[-1] org_name = report_metadata["org_name"] - if org_name is not None: + if org_name is not None and " " not in org_name: org_name = get_base_domain(org_name) new_report_metadata["org_name"] = org_name new_report_metadata["org_email"] = report_metadata["email"] diff --git a/parsedmarc/utils.py b/parsedmarc/utils.py index 97cde01d..c5f30edb 100644 --- a/parsedmarc/utils.py +++ b/parsedmarc/utils.py @@ -276,7 +276,9 @@ def get_ip_address_country(ip_address, parallel=False): location (str): Local location for the database file """ if parallel: - logging.warning("Cannot download GeoIP database in parallel mode") + logging.warning("GeoLite2-Country.mmdb is missing." + "please install and run geoipupdate as root to " + "get the latest version.") return url = "https://geolite.maxmind.com/download/geoip/database/" \ "GeoLite2-Country.tar.gz" diff --git a/setup.py b/setup.py index f73e670e..81e621ea 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ from setuptools import setup from codecs import open from os import path -__version__ = "6.4.1" +__version__ = "6.4.2" description = "A Python package and CLI for parsing aggregate and " \ "forensic DMARC reports"