PUNCH-Cyber / stoq-plugins-public

stoQ Public Plugins
https://stoq.punchcyber.com
Apache License 2.0
72 stars 24 forks source link

SMTP Plugin Fails on Invalid Dates #104

Closed malvidin closed 4 years ago

malvidin commented 4 years ago

The SMTP plugin fails to get any data when a date field is invalid. From the CDMC Spam dataset, TEST_00528.eml returns this error:

"error": "worker:failed to scan: File \"/usr/local/lib/python3.7/email/utils.py\", line 198, in parsedate_to_datetime ; TypeError: cannot unpack non-iterable NoneType object"

The offending string is: Date: 2002/09/14 Sat 13:06:03 GMT

mlaferrera commented 4 years ago

Thanks, @malvidin. This is actually a really annoying issue in python's email parser[1]. I've added handling for this issue, so it should work fine now.

[1] https://bugs.python.org/issue30681