Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- #um
- #Current hosts file blocks this update.
- sudo cp /etc/hosts /etc/hosts.old
- sudo cp /etc/hosts.off /etc/hosts
- #Delete old backups and create new.
- echo '
- Archiving hosts data directory...'
- find ~/hosts_bkup -mtime +7 -type f -delete
- cd ~/hosts/data/ || exit
- tar -cjf "Archive-$(date +"%Y-%m-%d").tar.xz" -- *
- mv "Archive-$(date +"%Y-%m-%d").tar.xz" ~/hosts_bkup/
- adblock='https://raw.githubusercontent.com/eladkarako/hosts.eladkarako.com/master/build/hosts_adblock.txt'
- bboys='https://raw.githubusercontent.com/mitchellkrogza/Badd-Boyz-Hosts/master/hosts'
- disad='https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt'
- dismal='https://s3.amazonaws.com/lists.disconnect.me/simple_malware.txt'
- dismvt='https://s3.amazonaws.com/lists.disconnect.me/simple_malvertising.txt'
- distra='https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt'
- fireag='https://v.firebog.net/hosts/AdguardDNS.txt'
- fireair='https://v.firebog.net/hosts/Airelle-trc.txt'
- fireel='https://v.firebog.net/hosts/Easylist.txt'
- fireep='https://v.firebog.net/hosts/Easyprivacy.txt'
- firepa='https://v.firebog.net/hosts/Prigent-Ads.txt'
- fireps='https://v.firebog.net/hosts/static/w3kbl.txt'
- hphosts='http://hosts-file.malwareteks.com/hosts.txt'
- hppart='https://hosts-file.net/hphosts-partial.txt'
- kadhosts='https://raw.githubusercontent.com/azet12/KADhosts/master/KADhosts.txt'
- opnphi='https://openphish.com/feed.txt'
- quidsup='https://raw.githubusercontent.com/quidsup/notrack/master/trackers.txt'
- roughted='https://gist.github.com/malwareinfosec/73d10721cdb9868a05baff6a59a6bcbc#file-roughted_list'
- echo '
- Updating AdBlock hosts...'
- rm -rf ~/hosts/data/adblock/hosts
- curl $adblock -o ~/hosts/data/adblock/hosts
- sed -i -e '/\[[^]]*\]/d' -e '/!/d' -e '/theguardian/d' -e '/nasa.gov/d' -e '/privateinternetaccess.com/d' -e 's/^/0.0.0.0 /' ~/hosts/data/adblock/hosts
- echo '
- Updating Badd-Boyz-Hosts...'
- rm -rf ~/hosts/data/Badd-Boyz-Hosts/hosts
- curl $bboys -o ~/hosts/data/Badd-Boyz-Hosts/hosts
- sed -i -e '/pastebin/d' -e '/[a-zA-Z]/!d' ~/hosts/data/Badd-Boyz-Hosts/hosts
- echo '
- Updating Disconnect filter lists...'
- rm -rf ~/hosts/data/disconnect-filters/hosts
- curl $disad $dismal $dismvt $distra >> ~/hosts/data/disconnect-filters/del
- sed -i -e '/[ #]/d' -e '/^$/d' -e 's/^/0.0.0.0 /' ~/hosts/data/disconnect-filters/del
- sort -u ~/hosts/data/disconnect-filters/del -o ~/hosts/data/disconnect-filters/hosts
- rm -rf ~/hosts/data/disconnect-filters/del
- echo '
- Updating Firebog block lists...'
- rm -rf ~/hosts/data/firebog/hosts
- curl $fireag $fireair $fireel $fireep $firepa $fireps >> ~/hosts/data/firebog/del
- sed -i -e '/^#/ d' -e '/^\s*$/d' -e 's/^/0.0.0.0 /' ~/hosts/data/firebog/del
- sort -u ~/hosts/data/firebog/del -o ~/hosts/data/firebog/hosts
- rm -rf ~/hosts/data/firebog/del
- echo '
- Updating hpHosts and hpHosts partial...'
- rm -rf ~/hosts/data/hphosts/hosts
- curl $hphosts -o ~/hosts/data/hphosts/del
- iconv -c -f utf-8 -t ascii ~/hosts/data/hphosts/del -o ~/hosts/data/hphosts/hosts
- sed -i -e '/[a-zA-Z]/!d' -e '/thedailybeast/d' ~/hosts/data/hphosts/hosts
- rm -rf ~/hosts/data/hphosts/del
- rm -rf ~/hosts/data/hppart/hosts
- curl $hppart -o ~/hosts/data/hppart/del
- iconv -c -f utf-8 -t ascii ~/hosts/data/hppart/del -o ~/hosts/data/hppart/hosts
- rm -rf ~/hosts/data/hppart/del
- echo '
- Updating KADhosts...'
- rm -rf ~/hosts/data/KADhosts/hosts
- curl $kadhosts -o ~/hosts/data/KADhosts/del
- iconv -c -f utf-8 -t ascii ~/hosts/data/KADhosts/del -o ~/hosts/data/KADhosts/hosts
- rm -rf ~/hosts/data/KADhosts/del
- echo '
- Updating openphish hosts...'
- rm -rf ~/hosts/data/openphish/hosts
- curl $opnphi -o ~/hosts/data/openphish/hosts
- sed -i -e 's/^/0.0.0.0 /' ~/hosts/data/openphish/hosts
- echo '
- Updating QuidsUp no track...'
- rm -rf ~/hosts/data/quidsup/hosts
- curl $quidsup -o ~/hosts/data/quidsup/hosts
- sed -i -e 's/[[:space:]]*#.*//' -e '/^$/d' -e 's/^/0.0.0.0 /' ~/hosts/data/quidsup/hosts
- echo '
- Updating RoughTed hosts...'
- rm -rf ~/hosts/data/roughted/hosts
- curl $roughted -o ~/hosts/data/roughted/hosts
- sed -i -e 's/^/0.0.0.0 /' ~/hosts/data/roughted/hosts
- #Reinstate old hosts file.
- sudo cp /etc/hosts.old /etc/hosts
- sudo chown root:root /etc/hosts
- echo '
- Miscellaneous host files updated.'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement