1
0
mirror of https://github.com/moparisthebest/pi-hole synced 2024-11-28 12:02:17 -05:00

Merge pull request #9 from mospaeda/master

Add a local blacklist file
This commit is contained in:
Jacob Salmela 2015-03-29 12:55:34 -05:00
commit 15c84db022

View File

@ -2,11 +2,12 @@
# The Pi-hole now blocks over 120,000 ad domains # The Pi-hole now blocks over 120,000 ad domains
# Address to send ads to (the RPi) # Address to send ads to (the RPi)
piholeIP="127.0.0.1" piholeIP="127.0.0.1"
# Optionally, uncomment to automatically detect the address. Thanks Gregg # Optionally, uncomment to automatically detect the local IP address.
#piholeIP=$(ifconfig eth0 | awk '/inet addr/{print substr($2,6)}') #piholeIP=$(hostname -I)
# Config file to hold URL rules # Config file to hold URL rules
eventHorizion="/etc/dnsmasq.d/adList.conf" eventHorizion="/etc/dnsmasq.d/adList.conf"
blacklist=/etc/pihole/blacklist.txt
whitelist=/etc/pihole/whitelist.txt whitelist=/etc/pihole/whitelist.txt
# Create the pihole resource directory if it doesn't exist. Future files will be stored here # Create the pihole resource directory if it doesn't exist. Future files will be stored here
@ -34,6 +35,14 @@ curl -s http://someonewhocares.org/hosts/hosts | grep -v "#" | sed '/^$/d' | sed
echo "Getting Mother of All Ad Blocks list..." # 102168 domains!! Thanks Kacy echo "Getting Mother of All Ad Blocks list..." # 102168 domains!! Thanks Kacy
curl -A 'Mozilla/5.0 (X11; Linux x86_64; rv:30.0) Gecko/20100101 Firefox/30.0' -e http://forum.xda-developers.com/ http://adblock.mahakala.is/ | grep -v "#" | awk '{print $2}' | sort >> /tmp/matter.txt curl -A 'Mozilla/5.0 (X11; Linux x86_64; rv:30.0) Gecko/20100101 Firefox/30.0' -e http://forum.xda-developers.com/ http://adblock.mahakala.is/ | grep -v "#" | awk '{print $2}' | sort >> /tmp/matter.txt
# Add entries from the local blacklist file if it exists in /etc/pihole directory
if [[ -f $blacklist ]];then
echo "Getting the local blacklist from /etc/pihole directory"
cat $blacklist >> /tmp/matter.txt
else
:
fi
# Sort the aggregated results and remove any duplicates # Sort the aggregated results and remove any duplicates
# Remove entries from the whitelist file if it exists at the root of the current user's home folder # Remove entries from the whitelist file if it exists at the root of the current user's home folder
if [[ -f $whitelist ]];then if [[ -f $whitelist ]];then
@ -54,4 +63,4 @@ echo "$numberOfAdsBlocked ad domains blocked."
sudo mv /tmp/andLight.txt $eventHorizion sudo mv /tmp/andLight.txt $eventHorizion
# Restart DNS # Restart DNS
sudo service dnsmasq restart sudo service dnsmasq restart