Skip to content

Instantly share code, notes, and snippets.

@NanoAi
Created August 16, 2015 06:24
Show Gist options
  • Save NanoAi/2d3440014cba9c2d3f6c to your computer and use it in GitHub Desktop.
Save NanoAi/2d3440014cba9c2d3f6c to your computer and use it in GitHub Desktop.
Hosts File Generator for Linux and Mac
#!/bin/bash
echo "/etc/hosts | Stats" && stat -x /etc/hosts && echo -n "Number of Lines: " && wc -l /etc/hosts && echo -n "MD5: " && md5 /etc/hosts
echo -e "\n-------------------------\n"
cp ~/bakup.hosts ~/hosts.uniq
curl --silent http://someonewhocares.org/hosts/hosts | grep '^127.0.0.1' >> ~/hosts.uniq && echo "someonewhocares.org : DONE"
curl --silent http://www.malwaredomainlist.com/hostslist/hosts.txt | grep '^127.0.0.1' >> ~/hosts.uniq && echo "malwaredomainlist.org : DONE"
curl --silent https://adaway.org/hosts.txt | grep '^127.0.0.1' >> ~/hosts.uniq && echo "adaway.org : DONE"
curl --silent http://winhelp2002.mvps.org/hosts.txt | grep '^127.0.0.1' >> ~/hosts.uniq && echo "mvps.org : DONE"
curl --silent http://hosts-file.net/ad_servers.txt | grep '^127.0.0.1' >> ~/hosts.uniq && echo "hosts-file.net : DONE"
curl --silent http://pgl.yoyo.org/adservers/serverlist.php -d hostformat=hosts -d showintro=0 -d mimetype=plaintext \
| grep '^127.0.0.1' >> ~/hosts.uniq && echo "yoyo.org : DONE"
uniq ~/hosts.uniq > /etc/hosts && rm -f ~/hosts.uniq
echo -e "\n-------------------------\n"
echo "/etc/hosts | Stats" && stat -x /etc/hosts && echo -n "Number of Lines: " && wc -l /etc/hosts && echo -n "MD5: " && md5 /etc/hosts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment