mirror of
https://github.com/novatiq/packages.git
synced 2026-04-30 07:28:39 +01:00
add list of domains serving advertising
Add a script to download a list of domains which serves ads. This list can be used to block these servers in the DNS server.
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
|
||||
file=/tmp/banhost
|
||||
|
||||
gethosts() {
|
||||
logger -t "banhost[$$]" "Update $file"
|
||||
wget -qO- http://winhelp2002.mvps.org/hosts.txt |awk 'BEGIN{printf "0.0.0.0"}/^0\.0\.0\.0/{printf " "$2}END{exit(!FNR)}' >$file || exit 1
|
||||
echo -n $time >$file.time
|
||||
exec killall -HUP dnsmasq
|
||||
}
|
||||
|
||||
if [ "$ACTION" = ifup -a "$INTERFACE" = wan ]; then
|
||||
read time </proc/uptime
|
||||
time=${time%%.*}
|
||||
|
||||
[ -f $file -a -f $file.time ] || gethosts
|
||||
read oldtime <$file.time
|
||||
[ $((time - oldtime)) -lt 604800 ] || gethosts
|
||||
fi
|
||||
Reference in New Issue
Block a user