From 26027ef6b3ab60ea2596adedeb608e8e6216f59d Mon Sep 17 00:00:00 2001 From: Sean Whalen Date: Tue, 5 Sep 2023 15:14:11 -0400 Subject: [PATCH] Add senders.sqlite --- parsedmarc/resources/senders/updatedb.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 parsedmarc/resources/senders/updatedb.py diff --git a/parsedmarc/resources/senders/updatedb.py b/parsedmarc/resources/senders/updatedb.py new file mode 100644 index 0000000..65c4052 --- /dev/null +++ b/parsedmarc/resources/senders/updatedb.py @@ -0,0 +1,19 @@ +import urllib.parse +import sqlite3 + +from bs4 import BeautifulSoup + +dmarc_io = "https://dmarc.io" +with open("sources.html") as sources_file: + content = sources_file.read() +soup = BeautifulSoup(content, "html.parser") +table = soup.find("tbody") +rows = table.find_all("tr") +for row in rows: + data = row.find_all("td") + link = data[0].find("a") + name = link.text + dmarc_io_url = urllib.parse.urljoin(dmarc_io, link.get("href")) + spf_aligned = len(data[1].find_all("i")) + dkim_aligned = len(data[2].find_all("i")) + print(name)