Update 2025-01-05 12:56 OpenBSD/amd64-t14
This commit is contained in:
parent
20f3483f9c
commit
a992796635
@ -1,11 +1,55 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
trap _restore_all 1 2 3 6
|
||||
|
||||
# list of filenames can can be fetched from $_url
|
||||
_list=/etc/unwind/blocklistproject.txt
|
||||
_url=https://blocklistproject.github.io/Lists/alt-version
|
||||
|
||||
# download blocklists here
|
||||
_dir=/etc/unwind/lists
|
||||
|
||||
# combined, sorted and filtered list of all lists configured in $_list
|
||||
# configure in /etc/unwind.conf:
|
||||
# block list "/etc/unwind/_assembled.txt" log
|
||||
_unwind_blocklist="/etc/unwind/_assembled.txt"
|
||||
|
||||
if [ ! -f $_list ]
|
||||
then
|
||||
echo "Creating new adlist /etc/unwind/blocklistproject.txt:"
|
||||
doas mkdir -p $_dir
|
||||
doas tee $_list <<EOF
|
||||
## from https://github.com/blocklistproject/Lists
|
||||
## ## => comment
|
||||
## # => disabled list (will be deleted if present)
|
||||
abuse-nl.txt
|
||||
adobe-nl.txt
|
||||
ads-nl.txt
|
||||
basic-nl.txt
|
||||
crypto-nl.txt
|
||||
drugs-nl.txt
|
||||
#everything-nl.txt
|
||||
facebook-nl.txt
|
||||
fortnite-nl.txt
|
||||
fraud-nl.txt
|
||||
gambling-nl.txt
|
||||
malware-nl.txt
|
||||
phishing-nl.txt
|
||||
piracy-nl.txt
|
||||
porn-nl.txt
|
||||
ransomware-nl.txt
|
||||
redirect-nl.txt
|
||||
scam-nl.txt
|
||||
smart-tv-nl.txt
|
||||
tiktok-nl.txt
|
||||
torrent-nl.txt
|
||||
tracking-nl.txt
|
||||
twitter-nl.txt
|
||||
vaping-nl.txt
|
||||
whatsapp-nl.txt
|
||||
youtube-nl.txt
|
||||
EOF
|
||||
fi
|
||||
|
||||
_restore_all() {
|
||||
echo "Signal received, aborting..."
|
||||
for _f in $_dir/*.old
|
||||
@ -53,21 +97,32 @@ _disabled() {
|
||||
return 1
|
||||
}
|
||||
|
||||
_domainfilter() {
|
||||
# chain grep commands used in assemble pipe
|
||||
grep -v "torrent"
|
||||
}
|
||||
|
||||
_assemble() {
|
||||
echo "Assemble blocklist: /etc/unwind/_assembled.txt"
|
||||
echo "Assemble blocklist: $_unwind_blocklist"
|
||||
cat $_dir/*.txt \
|
||||
| tr -d " " \
|
||||
| grep -v '^#' \
|
||||
| grep -v '^-' \
|
||||
| grep -v '^$' \
|
||||
| cut -d "#" -f1 \
|
||||
| doas sort -uo /etc/unwind/_assembled.txt
|
||||
| sed 's/\.$//g' \
|
||||
| _domainfilter \
|
||||
| doas sort -uo $_unwind_blocklist
|
||||
}
|
||||
|
||||
_restart_unwind() {
|
||||
doas rcctl restart unwind
|
||||
}
|
||||
|
||||
for _file in $(grep -v "^##" $_list | xargs)
|
||||
|
||||
for _file in $(grep -v "^##" $_list \
|
||||
| cut -d "#" -f1 \
|
||||
| xargs)
|
||||
do
|
||||
if ! _disabled $_file
|
||||
then
|
||||
|
Loading…
Reference in New Issue
Block a user