A Python-based tool to parse and visualize DMARC aggregate reports (XML format), helping domain owners monitor email authentication results over time.
- Parses DMARC XML reports (from Google, Microsoft, etc.)
- Visualizes:
- DKIM/SPF pass/fail trends over time
- Daily email volume by source (IP or hostname)
- Groups trusted senders (e.g., Google, Microsoft) under a single label
- Highlights anomalies and unknown sources
- DNS reverse lookup for friendlier source labeling
- Python 3.8+
- The following Python packages:
pandasmatplotlib
To install the required packages (without admin access):
pip install --user pandas matplotlib-
Download or clone this repository.
-
Put your DMARC XML reports in a folder (e.g.,
~/Downloads/DMARC-Reports/). -
Run the script:
python dmarc_visualizer.py /path/to/DMARC-ReportsOn Windows:
python dmarc_visualizer.py C:\Users\YourName\Downloads\DMARC-ReportsThe script will:
- Parse all
.xmlfiles in the folder - Reverse-lookup source IPs
- Group known senders (e.g., Google.com)
- Plot two charts:
- DKIM/SPF pass trend over time
- Email volume by source hostname per day
-
DKIM/SPF Trend Chart
Shows how many emails passed authentication per day. -
Source IP/Hostname Volume Chart
A stacked bar chart showing how many emails each source sent per day.
By default, the script groups well-known senders:
- Any hostname ending in
google.com→Google - Hostnames like
*.outlook.com,*.hotmail.com, or containingmicrosoft→Microsoft
You can customize this logic in the reverse_dns() function.
- Use a cron job or Windows Task Scheduler to run the script weekly.
- Export visualizations as PNGs or PDFs using
plt.savefig()if needed. - Consider adding logging or email alerts for failed authentication patterns.
-
Permission errors during
pip install
Use the--userflag as shown above. -
Reverse DNS lookups are slow
The script caches lookups using@lru_cacheto avoid repeating them.
MIT License – free for personal and commercial use.
Developed by New Idea Machine.
For feedback or contributions, feel free to open an issue or submit a PR.