Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- #!/bin/bash
- # Modified Pi-hole script to generate a generic hosts file
- # for use with dnsmasq's addn-hosts configuration
- # original : https://github.com/jacobsalmela/pi-hole/blob/master/gravity-adv.sh
- # Address to send ads to. This could possibily be removed, but may be useful for debugging purposes?
- destinationIP="10.0.30.3"
- permlist='/jffs/pattern.txt'
- outlist='/jffs/blocklist.txt'
- finalist='/jffs/domain.txt'
- tempoutlist="/tmp/outlist.tmp"
- echo "Apagando temporários..."
- COLOR_RED='\033[0;31m'
- COLOR_WHITE='\033[0m'
- COLOR_GREEN='\e[0;32m'
- [ -f /jffs/blocklist.txt.tmp ] && rm -f /jffs/blocklist.txt.tmp
- echo "Baixando yoyo ad lista..."
- curl --progress-bar -d mimetype=plaintext -d hostformat=unixhosts http://pgl.yoyo.org/adservers/serverlist.php? | sort > $tempoutlist
- echo "Baixando winhelp2002 ad lista..."
- curl --progress-bar http://winhelp2002.mvps.org/hosts.txt | grep -v "#" | grep -v "127.0.0.1" | sed '/^$/d' | sed 's/\ /\\ /g' | awk '{print $2}' | sort >> $tempoutlist
- echo "Baixando Zeustracker ad lista..."
- curl --progress-bar https://zeustracker.abuse.ch/blocklist.php?download=domainblocklist | grep -v "#" | grep -v "::1" | sed '/^$/d' | sed 's/\ /\\ /g' | awk '{print $2}' | grep -v '^\\' | grep -v '\\$' | sort >> $tempoutlist
- echo "Baixando Adblock-nocoin ad lista..."
- curl --progress-bar https://raw.githubusercontent.com/hoshsadiq/adblock-nocoin-list/master/hosts.txt | grep -v "#" | grep -v "::1" | sed '/^$/d' | sed 's/\ /\\ /g' | awk '{print $2}' | grep -v '^\\' | grep -v '\\$' | sort >> $tempoutlist
- echo "Baixando Adway ad lista..."
- curl --progress-bar https://adaway.org/hosts.txt | grep -v "#" | grep -v "127.0.0.1" | sed '/^$/d' | sed 's/\ /\\ /g' | awk '{print $2}' | sort >> $tempoutlist
- echo "Baixando malwaredomainlist ad lista..."
- curl --progress-bar http://www.malwaredomainlist.com/hostslist/hosts.txt | grep -v "#" | sed '/^$/d' | sed 's/\ /\\ /g' | awk '{print $3}' | grep -v '^\\' | grep -v '\\$' | sort >> $tempoutlist
- echo "Baixando Disconnect simple_tracking ad lista..."
- curl --progress-bar https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt | grep -v "#" | sed '/^$/d' | sed 's/\ /\\ /g' | grep -v '^\\' | grep -v '\\$' | awk '{print $2}' | grep -v '^\\' | grep -v '\\$' | sort >> $tempoutlist
- echo "Baixando Disconnect simple_ad ad lista...."
- curl --progress-bar https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt | grep -v "#" | grep -v "::1" | sed '/^$/d' | sed 's/\ /\\ /g' | awk '{print $2}' | grep -v '^\\' | grep -v '\\$' | sort >> $tempoutlist
- echo "Baixando Someonewhocares ad lista..."
- curl --progress-bar http://someonewhocares.org/hosts/hosts | grep -v "#" | sed '/^$/d' | sed 's/\ /\\ /g' | grep -v '^\\' | grep -v '\\$' | awk '{print $2}' | grep -v '^\\' | grep -v '\\$' | sort >> $tempoutlist
- echo "Baixando hosts-file ad lista..."
- curl --progress-bar http://hosts-file.net/ad_servers.txt | grep -v "#" | grep -v "::1" | sed '/^$/d' | sed 's/\ /\\ /g' | awk '{print $2}' | grep -v '^\\' | grep -v '\\$' | sort >> $tempoutlist
- echo "Baixando Ransomwaretracker ad lista..."
- curl --progress-bar https://ransomwaretracker.abuse.ch/downloads/RW_DOMBL.txt | grep -v "#" | grep -v "::1" | sed '/^$/d' | sed 's/\ /\\ /g' | awk '{print $2}' | grep -v '^\\' | grep -v '\\$' | sort >> $tempoutlist
- echo "Baixando CoinBlocker ad lista..."
- curl --progress-bar https://zerodot1.gitlab.io/CoinBlockerLists/hosts_browser | grep -v "#" | grep -v "::1" | sed '/^$/d' | sed 's/\ /\\ /g' | awk '{print $2}' | grep -v '^\\' | grep -v '\\$' | sort >> $tempoutlist
- echo "Baixando Immortal_domains ad lista..."
- curl --progress-bar http://mirror1.malwaredomains.com/files/immortal_domains.txt | grep -v "#" | grep -v "::1" | sed '/^$/d' | sed 's/\ /\\ /g' | awk '{print $2}' | grep -v '^\\' | grep -v '\\$' | sort >> $tempoutlist
- echo "Baixando WindowsSpyBlocker ad lista..."
- curl --progress-bar https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/spy.txt | grep -v "#" | grep -v "::1" | sed '/^$/d' | sed 's/\ /\\ /g' | awk '{print $2}' | grep -v '^\\' | grep -v '\\$' | sort >> $tempoutlist
- # Remove entries from the whitelist file if it exists at the root of the current user's home folder
- echo "Removendo formatações duplicadas na lista de domínios..."
- # Removed the uniq command, using sort -u. Removes the dependency on uniq, which is not available on the router by default or via opkg.
- # Added a rough way to exclude domains from the list. If you have a number of domains to whitelist, a better solution could be explored.
- cat $tempoutlist | sed $'s/\r$//' | sed '/thisisiafakedomain123\.com/d;/www\.anotherfakedomain123\.com/d' | sort -u | sed '/^$/d' | awk -v "IP=$destinationIP" '{sub(/\r$/,""); print IP" "$0}' > $outlist
- echo "Editando lista de dominios permitidos..."
- fgrep -vf $permlist $outlist > $finalist
- # Count how many domains/whitelists were added so it can be displayed to the user
- numberOfAdsBlocked=$(cat $finalist | wc -l | sed 's/^[ \t]*//')
- echo "$numberOfAdsBlocked domínios suspeitos bloqueados."
- echo "Removendo arquivos temporários..."
- rm $tempoutlist
- echo "Reiniciando servidores..."
- /opt/etc/init.d/S80pixelserv-tls restart
- service dnsmasq restart
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.