Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- gethosts.sh.orig 2014-06-03 12:13:38.568119496 +0200
- +++ gethosts.sh 2014-06-03 12:22:27.542742544 +0200
- @@ -8,10 +8,10 @@ echo "Vytvářím dočasné soubory"
- temphosts1=$(mktemp)
- temphosts2=$(mktemp)
- echo "Stahuji černou listinu"
- -wget -nv -O - http://winhelp2002.mvps.org/hosts.txt >> $temphosts1
- -wget -nv -O - http://hosts-file.net/ad_servers.asp >> $temphosts1
- -wget -nv -O - http://someonewhocares.org/hosts/hosts >> $temphosts1
- -wget -nv -O - "http://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&mimetype=plaintext" >> $temphosts1
- +wget -nv -O - http://winhelp2002.mvps.org/hosts.txt >> "$temphosts1"
- +wget -nv -O - http://hosts-file.net/ad_servers.asp >> "$temphosts1"
- +wget -nv -O - http://someonewhocares.org/hosts/hosts >> "$temphosts1"
- +wget -nv -O - "http://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&mimetype=plaintext" >> "$temphosts1"
- echo "Upravuji černou listinu:
- # 1. Odstranění znaků Carriage Return...
- # 2. Mazání řádků, které nezačínají 127.0.0.1...
- @@ -21,13 +21,14 @@ echo "Upravuji černou listinu:
- # 6. Odstranění komentářů...
- # 7. Vyčištění koncových mezer
- # 8. Třídění a odstranění duplicit..."
- -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]*$//' < $temphosts1 | sort -u > $temphosts2
- +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]*$//' < "$temphosts1" | sort -u > "$temphosts2"
- +
- # Combine system hosts with adblocks
- echo "Slučuji s původním hosts souborem..."
- -echo -e "\n# Vygenerováno dne $(date)" | cat /etc/hosts.d/hosts.conf - $temphosts2 > /etc/hosts.d/hosts-block
- -echo -e "\n# Blokováno $(cat /etc/hosts.d/hosts-block | grep 0.0.0.0 | wc -w) adres" >> /etc/hosts.d/hosts-block
- +echo -e "\n# Vygenerováno dne $(date)" | cat /etc/hosts.d/hosts.conf - "$temphosts2" > /etc/hosts.d/hosts-block
- +echo -e "\n# Blokováno $(cat /etc/hosts.d/hosts-block | fgrep 0.0.0.0 | wc -w) adres" >> /etc/hosts.d/hosts-block
- echo "Čistím dočasné soubory..."
- -rm $temphosts1 $temphosts2
- +rm "$temphosts1" "$temphosts2"
- echo "Kopíruji zpět vylepšený soubor /etc/hosts"
- cp /etc/hosts.d/hosts-block /etc/hosts
- echo "Hotovo"
Advertisement
Add Comment
Please, Sign In to add comment