feat: generate blacklist from Dan Pollock’s hosts

This commit is contained in:
ange 2024-12-26 08:00:28 +00:00
parent 33d6a9c1cc
commit 62c8ff645a
Signed by: ange
GPG Key ID: 9E0C4157BB7BEB1D
2 changed files with 5607 additions and 2177 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,27 @@
#!/usr/bin/env python3
import urllib.request as request
import re
HOSTS = "https://someonewhocares.org/hosts/zero/hosts"
OUTPUT = "config/hostnames_remove.yml"
def main():
with request.urlopen(HOSTS) as i:
with open(OUTPUT, "w+") as o:
print(
*sorted(
[
rf"- '(.*\.)?{re.escape(l.split()[1])}$'"
for l in i.read().decode("utf-8").split("\n")
if l.startswith("0")
]
),
sep="\n",
file=o,
)
if __name__ == "__main__":
main()