feat: generate blacklist from Dan Pollock’s hosts
This commit is contained in:
parent
33d6a9c1cc
commit
62c8ff645a
File diff suppressed because it is too large
Load Diff
27
generate_hostnames_remove.py
Normal file
27
generate_hostnames_remove.py
Normal 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()
|
Loading…
Reference in New Issue
Block a user