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

Running from Jupyter Notebook #339

Open toroskilly opened 2 years ago

toroskilly commented 2 years ago

I am running parsedmarc successfully from a Jupyter Notebook, but have reached the point where the IP database is more than a month old. parsedmarc is really cool, I am a massive fan.

I am using Jupyter, because I am new to Python and am still working out how I want to use this info, etc. Jupyter helps me isolate parts of my scripts, whilst I blunder along.

I interact directly with my Outlook Application, to get the raw reports, rather than using an IMAP config. So, I imagined that all I needed to do to get the latest IP database was put the following in my parsedmarc.ini file (Windows user) and setup GeoIPUpdate (which I have done):

[general]
ip_db_path = C:\ProgramData\MaxMind\GeoIPUpdate\GeoIP

I believe I may come across some issues with the above, because I have not specified IMAP or file_path in the config file. Is there something I can add to get around this?

However, before I can test the above, I am unsure of how I can reference the Config file from my IPYNB script. Could I just put the ip_db_path in my script and forget the Config file?

nathanthorpe commented 2 years ago

If you are running from a notebook, I would expect that you'd use the get_dmarc_reports_from_mbox function directly and not use the config file or really anything from cli.py. In that case you'd put ip_db_path in your script.

leonardo0014 commented 2 years ago

Remember that the ip_db_path option wants a file, not just a path.