Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- ###
- # Script that modifies the /etc/hosts file to blacklist malicious and
- # advertising-related domains.
- ###
- temphosts=$(mktemp)
- # Make a backup if one doesn't already exist
- [ ! -e /etc/hosts.bk ] && cp /etc/hosts /etc/hosts.bk
- # Download the new hosts file, overwriting the original
- ## Download various pre-made lists into our temp file
- wget -nv -O - http://someonewhocares.org/hosts/hosts >> $temphosts
- wget -nv -O - http://winhelp2002.mvps.org/hosts.txt >> $temphosts
- wget -nv -O - http://www.malwaredomainlist.com/hostslist/hosts.txt >> $temphosts
- wget -nv -O - http://adblock.gjtech.net/?format=hostfile >> $temphosts
- wget -nv -O - http://hosts-file.net/ad_servers.asp >> $temphosts
- wget -nv -O - "http://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&mimetype=plaintext" >> $temphosts
- wget -nv -O - http://www.sysctl.org/cameleon/hosts >> $temphosts
- wget -nv -O - http://securemecca.com/Downloads/hosts.txt >> $temphosts
- sed -e 's/\r//' -e '/^127.0.0.1/!d' -e '/localhost/d' -e 's/127.0.0.1/0.0.0.0/' -e 's/ \+/\t/' -e 's/#.*$//' -e 's/[ \t]*$//' < $temphosts | sort | uniq -u > /etc/hosts
- #
- echo "# Last updated on $(date)
- 127.0.0.1 localhost <your host name here or sudo will hang when you first launch it>
- " | cat - /etc/hosts >> temp && mv temp /etc/hosts
- rm $temphosts
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement