From: Enju Aihara <5-EnjuAihara@users.noreply.gitlab.varis.social> Date: Thu, 3 Mar 2022 22:04:55 +0000 (+0100) Subject: added database preloaded with domains and hashes X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=303ab15adcf42dd9ca334c4d1933bc49557ceb70;p=fba.git added database preloaded with domains and hashes --- diff --git a/blocks_preloaded.db b/blocks_preloaded.db new file mode 100644 index 0000000..41f5482 Binary files /dev/null and b/blocks_preloaded.db differ diff --git a/preload_db.py b/preload_db.py new file mode 100644 index 0000000..fde4eaf --- /dev/null +++ b/preload_db.py @@ -0,0 +1,17 @@ +import sqlite3 +from hashlib import sha256 + +conn = sqlite3.connect("blocks_default.db") +c = conn.cursor() + +with open("pleroma_instances.txt", "r") as f: + while line := f.readline(): + print(line.rstrip(), sha256(bytes(line.rstrip(), "utf-8")).hexdigest()) + c.execute(f"insert into instances select \"{line.rstrip()}\", \"{sha256(bytes(line.rstrip(), 'utf-8')).hexdigest()}\"") + conn.commit() + +with open("mastodon_instances.txt", "r") as f: + while line := f.readline(): + print(line.rstrip(), sha256(bytes(line.rstrip(), "utf-8")).hexdigest()) + c.execute(f"insert into instances select \"{line.rstrip()}\", \"{sha256(bytes(line.rstrip(), 'utf-8')).hexdigest()}\"") + conn.commit() \ No newline at end of file