@ -10,8 +10,8 @@ sources=('http://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&mimetype
'https://adaway.org/hosts.txt'
'http://hosts-file.net/.%5Cad_servers.txt'
'http://www.malwaredomainlist.com/hostslist/hosts.txt'
'http://someonewhocares.org/hosts/hosts'
'http://adblock.gjtech.net/?format=unix-hosts'
'http://someonewhocares.org/hosts/hosts'
'http://adblock.mahakala.is/' )
# Variables for various stages of downloading and formatting the list
@ -21,7 +21,7 @@ justDomainsExtension=domains
matter = pihole.0.matter.txt
andLight = pihole.1.andLight.txt
supernova = pihole.2.supernova.txt
eventHoriz i on= pihole.3.eventHorizon.txt
eventHoriz on= pihole.3.eventHorizon.txt
accretionDisc = pihole.4.accretionDisc.txt
eyeOfTheNeedle = pihole.5.wormhole.txt
adList = /etc/dnsmasq.d/adList.conf
@ -92,13 +92,13 @@ function gravity_advanced()
echo " $numberOf domains being pulled in by gravity... "
# Remove lines with no dots (i.e. localhost, localdomain, etc)
echo -n "" > $origin /$supernova | grep '\.' $origin /$andLight >> $origin /$supernova
# Remove newlines, sort by TLD, remove subdomains , and remove duplicates
cat $origin /$supernova | sed $'s/\r$//' | awk -F. '{for (i=NF; i>1; --i) printf "%s.",$i;print $1}' | sort -t'.' -k1,2 | awk -F. 'NR!=1&&substr($0,1,length(p))==p {next} {p=$0".";for (i=NF; i>1; --i) printf "%s.",$i;print $1}' | uniq > $origin /$eventHoriz i on
numberOf = $( cat $origin /$eventHoriz i on | wc -l | sed 's/^[ \t]*//' )
# Remove newlines, blank lines, sort , and remove duplicates
cat $origin /$supernova | sed $'s/\r$//' | sed '/^$/d' | sort | uniq > $origin /$eventHoriz on
numberOf = $( cat $origin /$eventHoriz on | wc -l | sed 's/^[ \t]*//' )
echo " $numberOf unique domains trapped in the event horizon. "
# Format domain list as address=/example.com/127.0.0.1
echo "** Formatting domains into a dnsmasq file..."
cat $origin /$eventHoriz i on | awk -v " IP= $piholeIP " '{sub(/\r$/,""); print "address=/"$0"/"IP}' > $origin /$accretionDisc
cat $origin /$eventHoriz on | awk -v " IP= $piholeIP " '{sub(/\r$/,""); print "address=/"$0"/"IP}' > $origin /$accretionDisc
sudo cp $origin /$accretionDisc $adList
sudo service dnsmasq restart
}