I'm sure it could be better.
Please comment.
Many Thanks
Code: Select all
#!/bin/bash
cd /tmp # switch to tmp directory
wget http://someonewhocares.org/hosts/ipv6/"hosts" # download data
#
if test -s hosts # file exists and it's size is greater than zero
then
rm /etc/hosts # remove file hosts from /etc
cp /home/sam/.etchosts /etc/hosts # copy backup of file hosts back to /etc/hosts
sed -i 1,10d hosts # remove lines 1 to 10 from file hosts
sed -i 2,66d hosts # remove lines 2 to 66 from file hosts
sed -i -e 's/127.0.0.1/0.0.0.0/g' hosts # remove string 127.0.0.1 and replace it with 0.0.0.0
cat hosts >> /etc/hosts # add the data from file hosts to /etc/hosts
rm hosts # remove tmp file hosts
else
if test -e hosts # file exists and it's size is likely zero
then
rm hosts # remove tmp file hosts
fi
fi
Code: Select all
127.0.0.1 localhost
127.0.1.1 sam-L500
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
# Last updated: Fri, 27 Oct 2017 at 07:29:49 GMT
#<shock-sites>
# For example, to block unpleasant pages, try:
0.0.0.0 goatse.cx # More information on sites such as
::1 goatse.cx # More information on sites such as
0.0.0.0 www.goatse.cx # these can be found in this article
::1 www.goatse.cx # these can be found in this article
0.0.0.0 oralse.cx # en.wikipedia.org/wiki/List_of_shock_sites
::1 oralse.cx # en.wikipedia.org/wiki/List_of_shock_sites
0.0.0.0 www.oralse.cx
::1 www.oralse.cx
0.0.0.0 goatse.ca
::1 goatse.ca
0.0.0.0 www.goatse.ca
::1 www.goatse.ca
0.0.0.0 oralse.ca
::1 oralse.ca
0.0.0.0 www.oralse.ca
::1 www.oralse.ca
0.0.0.0 goat.cx