Thanks for the scripts! I modified the "advanced" one as follow (AC68):
1) Put the content in wan-start, instead of service-start (which didn't work for me for some reason)
2) Never installed entware, therefore removed the "/opt/etc/init.d/rc.unslung start" line and modified all the /tmp/mnt/sda1/* references.
3) update-hosts.sh: Modified the middle portion like this:
Code:
# get hosts files and combine
wget -qO- \
"http://winhelp2002.mvps.org/hosts.txt" \
"http://someonewhocares.org/hosts/zero/hosts" \
"http://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&startdate[day]=&startdate[month]=&startdate[year]=&mimetype=plaintext&useip=0.0.0.0" \
"http://www.malwaredomainlist.com/hostslist/hosts.txt" \
"http://hosts-file.net/ad_servers.txt" \
> $dir/temphost
# replace all 127.0.0.1 with 0.0.0.0 if any, grab only the first 2 parts (IP, hostname) of each line, and sort the combined entries
cat $dir/temphost | sed s/127.0.0.1/0.0.0.0/g | sed $'s/\r$//' | grep -w ^0.0.0.0 | awk '{print $1 " " $2}' | sort -u > $dir/temphost2
# remove whitelisted entries in temp and write final file, remove temp file
cat $dir/whitelist.txt | sed $'s/\r$//' | grep -vf - $dir/temphost2 > $dir/hosts.blocked
#remove temp files
rm $dir/temphost
rm $dir/temphost2
The reasons are
a) the entries in the 2nd wget aren't sorted against the entries from the 1st wget
b) some entries come with comments
c) different sites use different delimiters: yoyo.org etc use single space, malewaredomainlist.com uses double spaces, and hosts-file.net uses tab. So I use awk to grab only $1 (0.0.0.0) and $2 (hostname) and feed sort -u with only the "cleansed" entries.