You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
This script parses DMARC XML files, extracts relevant information, and performs reverse DNS lookups on source IP addresses. The parsed data is then saved to a CSV file.
The parsed data will be saved topath.csv in the specified destination directory.
How It Works
Reverse DNS Lookup:
Thereverse_dns_lookup function takes an IP address and checks if it has already been resolved. If not, it performs a reverse DNS lookup to find the associated host name.
DMARC XML Parsing:
Theparse_dmarc_xml function parses DMARC XML files, extracts information about emails that did not pass DMARC checks, and appends this data to a list.
Main Execution Flow:
Themain function handles the overall flow:
Checks if the source and destination directories exist.
Iterates through each XML file in the destination directory, parsing them and collecting records.
Performs reverse DNS lookups on the collected records.
Converts the records to a pandas DataFrame and saves it to a CSV file.
Notes
Ensure that the source and destination directories contain the appropriate XML files for parsing.
The script includes a progress bar for both XML parsing and reverse DNS lookups for better user experience.
Duplicate records are handled by summing the email counts of the duplicates.
Example
Here is an example of the output after running the script: