SHOW:
|
|
- or go back to the newest paste.
| 1 | #!/bin/sh | |
| 2 | RED='\033[0;31m' | |
| 3 | GREEN='\033[0;32m' | |
| 4 | NC='\033[0m' | |
| 5 | LBLUE='\033[1;34m' | |
| 6 | ||
| 7 | if /etc/amod/bin/cron check dnsmasq; then | |
| 8 | echo "${GREEN}Cron a posto!${NC}\n"
| |
| 9 | else | |
| 10 | /etc/amod/bin/cron add "30 13 * * * /mnt/shares/U/conf/dnsmasq_update_adblock.sh" | |
| 11 | echo "${RED}Cron non era a posto: ${GREEN}sistemato!${NC}\n"
| |
| 12 | fi | |
| 13 | ||
| 14 | if amodfunc wanip >/dev/null 2>&1; then | |
| 15 | echo "${GREEN}Online${NC}\n"
| |
| 16 | - | cd /var/mnt/usb0/part1/conf |
| 16 | + | cd /mnt/shares/U/conf || exit |
| 17 | ||
| 18 | echo "Downloading file from YoYo, SWC, MVPS, EasyList and malwaredomains${LBLUE}"
| |
| 19 | curl --progress-bar -o yoyo http://pgl.yoyo.org/as/serverlist.php?hostformat=hosts&showintro=0 | |
| 20 | curl --progress-bar -o swc http://someonewhocares.org/hosts/hosts | |
| 21 | curl --progress-bar -o mvps http://winhelp2002.mvps.org/hosts.txt | |
| 22 | curl --progress-bar --insecure -o malware https://easylist-downloads.adblockplus.org/malwaredomains_full.txt | |
| 23 | curl --progress-bar --insecure -o easy https://easylist-downloads.adblockplus.org/easylistitaly+easylist.txt | |
| 24 | ||
| 25 | echo "${NC}Processing YoYo.org file"
| |
| 26 | cat yoyo | grep "127.0.0.1" | awk '{ print "127.0.0.1\t"$2 }' >> adblock
| |
| 27 | echo "Processing SomeoneWhoCares.org file" | |
| 28 | cat swc | grep "127.0.0.1" | awk '{ print "127.0.0.1\t"$2 }' | grep -v "#" >> adblock
| |
| 29 | echo "Processing MVPS.org file" | |
| 30 | cat mvps | grep 0.0.0.0 | grep -v "# 0.0.0.0" | awk '{ print "127.0.0.1\t"$2 }' >> adblock
| |
| 31 | echo "Processing Easylist" | |
| 32 | cat easy | grep ^\|\|[^\*]*\^$ | sed -e 's:||:127.0.0.1 :' -e ' s:\^::' > /mnt/shares/U/conf/easy | |
| 33 | sed -i "s/127.0.0.1/127.0.0.1 /g" easy | |
| 34 | echo "Processing malicious sites list" | |
| 35 | cat malware | grep ^\|\|[^\*]*\^$ | sed -e 's:||:127.0.0.1 :' -e 's:\^::' >> /mnt/shares/U/conf/malware | |
| 36 | sed -i "s/127.0.0.1/127.0.0.1 /g" malware | |
| 37 | ||
| 38 | [ -e mylist ] && {
| |
| 39 | echo "Merging mylist" | |
| 40 | sed -i -e '$a\' adblock | |
| 41 | cat mylist >> adblock | |
| 42 | } | |
| 43 | echo "Merging malware and easylist do adblock" | |
| 44 | sed -i -e '$a\' adblock | |
| 45 | - | cat malwaredomains_full.txt >> adblock |
| 45 | + | cat malware >> adblock |
| 46 | sed -i -e '$a\' adblock | |
| 47 | - | cat easylistitaly\+easylist.txt >> adblock |
| 47 | + | cat easy >> adblock |
| 48 | ||
| 49 | echo "Writing changes to zone file" | |
| 50 | tr '[A-Z]' '[a-z]' < adblock | sort -fu > adblock.uniq | |
| 51 | sed -i '/^!/ d' adblock.uniq | |
| 52 | rm yoyo swc mvps adblock malware easy | |
| 53 | else | |
| 54 | echo "${RED}Offline"
| |
| 55 | fi | |
| 56 | ||
| 57 | killall -q -SIGHUP dnsmasq || {
| |
| 58 | echo "dnsmasq not running...${NC}"
| |
| 59 | /usr/etc/amod/init.d/dns start | |
| 60 | } |