userjack6880 / Open-Report-Parser

A Perl based tool to parse DMARC reports from an IMAP mailbox or from the filesystem, and insert the information into a database. Derived from Techsneeze's dmarcts-report-parser
GNU General Public License v3.0
33 stars 9 forks source link

[Question]: Open Report Parser: The xml file does not seem to contain a valid DMARC report. Skipped. #26

Closed robbrandt closed 7 months ago

robbrandt commented 7 months ago

OK, so I am switching to reading XML files directly rather than from emails. (I have a semi automated system for doing this which I will document once I have it polished). But I can't get any of my reports to be parsed. All come up with the above error.

I've added the -d flag for more detail.

`baccount@ip-xxx-xxx-xxx-xxx:~/domains/dmarc.baccount.org/public_html/Open-Report-Parser$ ./report-parser.pl -x -d ../../dmarcreports/appstate.xml

--- DEBUG --- Open Report Parser Version 0 Alpha 5

Open Report Parser DEBUG ENABLED -- Script Options --

Report Source: 2 (0: IMAP, 1: Message, 2: XML, 3: MBOX, 4: ZIP, 5: JSON) Show Processed: 0 Delete Reports: 0 Delete Failed: 0 Replace Reports: 0 DMARC Only: 1 (0: DMARC\TLS, 1: DMARC Only, -1: TLS Only)

-- Database Options --

DB Type: mysql DB Name: dmarc DB User: baccount DB Host/Port: localhost:3306 DB TX Support: 1

Max XML Size: 50000 Max JSON Size: 50000 Compress XML: 0 Compress JSON: 0

-- IMAP Options --

IMAP Server: smtp.gmail.com IMAP Port: 993 TLS: 0 SSL: 1 TLS Verify: 0 IMAP User: dmarc@baccount.org IMAP Ignore Err: 0 IMAP Auth: oauth2 Oauth2 URI: https://accounts.google.com/o/oauth2/v2/auth OAuth2 Client ID: DMARC Folders: Reports: dmarc TLS Folders: Reports: tls


Processing xml file <../../dmarcreports/appstate.xml>

Type: 2 FileContent: ?Tێ? }?W?C?6?W?%??'?!A?N??!??d??)̙?s?(TȞ?+???Fo????????R??g}?F?\????????w.D?9?r???\??????Ƚx?r????<5??=?5???i?,ÁW0O?ڴd-QU%??u??????J????q???Ac?ynγp?z8kL?X?rlOZfd郑??G?ԧ5????m? uv??sS??p?U??, ?m???4? ?>?W=2O?|????K?r?X?ts??ʉ?H??9????? ?e??Z?;y?v????P??.C?˨??A2Z???|p?Äiɥ?"??٠cڿlb???R???k?Y??Tr?V??kN?<?3?%??????]?K??v|?,{|ۉ AF?Vc?á%?(­0Ӫ??f/ܔO???79OV??/9@D???x-?~?????5?=?Źq?????٘\??{???.?SI?yMi?????vK?? MSG: xml file <../../dmarcreports/appstate.xml>

--- DEBUG --- getting XML from string

Open Report Parser: The xml file <../../dmarcreports/appstate.xml> does not seem to contain a valid DMARC report. Skipped.

--- DEBUG --- Open Report Parser: Processed 1 messages(s).`

Obviously there's a lot of garbage showing in the FileContent, but it doesn't appear that way when I view it manually. And if I open it in a text editor it shows it's encoded for UTF-8 so I don't think it's an encoding error.

Ideas?

robbrandt commented 7 months ago

I finally found 1 report that worked, a zip file from Google.

robbrandt commented 7 months ago

This seems to have been resolved, but I am not sure why. Possibly I was using compressed files when I thought I was using raw xml. In the process I was using to manipulate the files the file extensions were being removed.