domainaware / parsedmarc

A Python package and CLI for parsing aggregate and forensic DMARC reports
https://domainaware.github.io/parsedmarc/
Apache License 2.0
1.02k stars 224 forks source link

Problem parsing forensic report #47

Closed dpepper-rms closed 5 years ago

dpepper-rms commented 5 years ago

I recently started receiving forensic reports (which may or may not be valid). However they generated an Unexpected error. I updated to the latest 5.2.1 and deleted the forensic reports from my mailbox, but still get the error below.

parsedmarc -n adsrms01.rms.com -t 1 -o dmarc-rpts -H outlook.office365.com -u xxx -p xxx --imap-port 993 -E localhost:9200 --save-aggregate --save-forensic -w >> dmarc.log Traceback (most recent call last): File "c:\python\python37-32\lib\site-packages\parsedmarc__init__.py", line 537, in parse_forensic_report "Forensic sample is not a valid email") parsedmarc.InvalidForensicReport: Forensic sample is not a valid email

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "c:\python\python37-32\lib\site-packages\parsedmarc__init.py", line 724, in parse_report_email strip_attachment_payloads=strip_attachment_payloads) File "c:\python\python37-32\lib\site-packages\parsedmarc\init.py", line 607, in parse_forensic_report "Unexpected error: {0}".format(error.str__())) parsedmarc.InvalidForensicReport: Unexpected error: Forensic sample is not a valid email

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "c:\python\python37-32\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "c:\python\python37-32\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Python\Python37-32\Scripts\parsedmarc.exe__main__.py", line 9, in File "c:\python\python37-32\lib\site-packages\parsedmarc\cli.py", line 343, in _main strip_attachment_payloads=sa File "c:\python\python37-32\lib\site-packages\parsedmarc__init.py", line 1010, in get_dmarc_reports_from_inbox strip_attachment_payloads=sa) File "c:\python\python37-32\lib\site-packages\parsedmarc\init.py", line 726, in parse_report_email raise ParserError(e.str__()) parsedmarc.ParserError: Unexpected error: Forensic sample is not a valid email

seanthegeek commented 5 years ago

Hi.

WARNING: Your original post of this issue had your Office 365 IMAP credentials in it! You edited them out later, but anyone who is watching this project on GitHub (which anyone can do - currently 5 people) got a copy of the original issue in an email. Please change that user's password ASAP!

I think I fixed the exception. Can you please test the fix before I release the now version?

To install the latest dev release run the following command as an admin (I see you're on Windows):

pip install -U git+https://github.com/domainaware/parsedmarc.git

Then try running parsedmarc again.