added database preloaded with domains and hashes
This commit is contained in:
parent
f432c6290f
commit
303ab15adc
BIN
blocks_preloaded.db
Normal file
BIN
blocks_preloaded.db
Normal file
Binary file not shown.
17
preload_db.py
Normal file
17
preload_db.py
Normal file
@ -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()
|
Loading…
x
Reference in New Issue
Block a user