]> git.mxchange.org Git - fba.git/commitdiff
added database preloaded with domains and hashes
authorEnju Aihara <5-EnjuAihara@users.noreply.gitlab.varis.social>
Thu, 3 Mar 2022 22:04:55 +0000 (23:04 +0100)
committerEnju Aihara <5-EnjuAihara@users.noreply.gitlab.varis.social>
Thu, 3 Mar 2022 22:04:55 +0000 (23:04 +0100)
blocks_preloaded.db [new file with mode: 0644]
preload_db.py [new file with mode: 0644]

diff --git a/blocks_preloaded.db b/blocks_preloaded.db
new file mode 100644 (file)
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 (file)
index 0000000..fde4eaf
--- /dev/null
@@ -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