From 5f3cb2e569479d4f6d1d716311f1c221d60cd747 Mon Sep 17 00:00:00 2001 From: Mospaeda Date: Thu, 19 Mar 2015 22:59:55 +0100 Subject: [PATCH 1/6] Update gravity-adv.sh --- gravity-adv.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gravity-adv.sh b/gravity-adv.sh index 5de6c4d..77646ae 100755 --- a/gravity-adv.sh +++ b/gravity-adv.sh @@ -7,6 +7,10 @@ piholeIP="127.0.0.1" # Config file to hold URL rules eventHorizion="/etc/dnsmasq.d/adList.conf" + + + + whitelist=/etc/pihole/whitelist.txt # Create the pihole resource directory if it doesn't exist. Future files will be stored here @@ -54,4 +58,4 @@ echo "$numberOfAdsBlocked ad domains blocked." sudo mv /tmp/andLight.txt $eventHorizion # Restart DNS -sudo service dnsmasq restart \ No newline at end of file +sudo service dnsmasq restart From 185969b137119f8c01e54bc91bc3eacbb5b46db9 Mon Sep 17 00:00:00 2001 From: Mospaeda Date: Thu, 19 Mar 2015 23:09:36 +0100 Subject: [PATCH 2/6] Update gravity-adv.sh Add a local blacklist file --- gravity-adv.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/gravity-adv.sh b/gravity-adv.sh index 77646ae..0df27ef 100755 --- a/gravity-adv.sh +++ b/gravity-adv.sh @@ -7,10 +7,7 @@ piholeIP="127.0.0.1" # Config file to hold URL rules eventHorizion="/etc/dnsmasq.d/adList.conf" - - - - +blacklist=/etc/pihole/blacklist.txt whitelist=/etc/pihole/whitelist.txt # Create the pihole resource directory if it doesn't exist. Future files will be stored here @@ -38,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 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 /etc/pihole/blacklist.txt >> /tmp/matter.txt +else + echo "No local blacklist.txt file available on /etc/pihole directory" +fi + # 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 if [[ -f $whitelist ]];then From 7809ee386edeaca7976ca6f57684ac33426166e6 Mon Sep 17 00:00:00 2001 From: mospaeda Date: Fri, 20 Mar 2015 23:37:04 +0100 Subject: [PATCH 3/6] Update gravity-adv.sh --- gravity-adv.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gravity-adv.sh b/gravity-adv.sh index 0df27ef..2b9431b 100755 --- a/gravity-adv.sh +++ b/gravity-adv.sh @@ -38,9 +38,9 @@ curl -A 'Mozilla/5.0 (X11; Linux x86_64; rv:30.0) Gecko/20100101 Firefox/30.0' - # 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 /etc/pihole/blacklist.txt >> /tmp/matter.txt + cat $blacklist >> /tmp/matter.txt else - echo "No local blacklist.txt file available on /etc/pihole directory" + : fi # Sort the aggregated results and remove any duplicates From d586ba312611daa440d1f663d123e708716682a9 Mon Sep 17 00:00:00 2001 From: mospaeda Date: Sat, 21 Mar 2015 00:00:09 +0100 Subject: [PATCH 4/6] Automatic IP detection with all locale --- gravity-adv.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gravity-adv.sh b/gravity-adv.sh index 2b9431b..e89e1e4 100755 --- a/gravity-adv.sh +++ b/gravity-adv.sh @@ -4,6 +4,11 @@ piholeIP="127.0.0.1" # Optionally, uncomment to automatically detect the address. Thanks Gregg #piholeIP=$(ifconfig eth0 | awk '/inet addr/{print substr($2,6)}') +# Below code allows to automatically detect the address with all locale +langsys=$LANG +LANG=en_US.utf8 +piholeIP=$(ifconfig eth0 | awk '/inet addr/{print substr($2,6)}') +LANG=$langsys # Config file to hold URL rules eventHorizion="/etc/dnsmasq.d/adList.conf" From 5d37b597682a8f830acd1bc82c026182bbe7896b Mon Sep 17 00:00:00 2001 From: mospaeda Date: Mon, 23 Mar 2015 19:43:13 +0100 Subject: [PATCH 5/6] Blacklist and automatic detection of IP address detection is valid for all languages --- gravity-adv.sh | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/gravity-adv.sh b/gravity-adv.sh index e89e1e4..41fbf7a 100755 --- a/gravity-adv.sh +++ b/gravity-adv.sh @@ -2,13 +2,8 @@ # The Pi-hole now blocks over 120,000 ad domains # Address to send ads to (the RPi) piholeIP="127.0.0.1" -# Optionally, uncomment to automatically detect the address. Thanks Gregg -#piholeIP=$(ifconfig eth0 | awk '/inet addr/{print substr($2,6)}') -# Below code allows to automatically detect the address with all locale -langsys=$LANG -LANG=en_US.utf8 -piholeIP=$(ifconfig eth0 | awk '/inet addr/{print substr($2,6)}') -LANG=$langsys +# Optionally, uncomment to automatically detect the local IP address. +# piholeIP=$(hostname -I) # Config file to hold URL rules eventHorizion="/etc/dnsmasq.d/adList.conf" From a11fe15d1ba822ec951cdf62fcfe7e5dd4571b32 Mon Sep 17 00:00:00 2001 From: mospaeda Date: Mon, 23 Mar 2015 19:47:35 +0100 Subject: [PATCH 6/6] Automatic detection via hostname command --- gravity-adv.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gravity-adv.sh b/gravity-adv.sh index 41fbf7a..4b62817 100755 --- a/gravity-adv.sh +++ b/gravity-adv.sh @@ -3,7 +3,7 @@ # Address to send ads to (the RPi) piholeIP="127.0.0.1" # Optionally, uncomment to automatically detect the local IP address. -# piholeIP=$(hostname -I) +#piholeIP=$(hostname -I) # Config file to hold URL rules eventHorizion="/etc/dnsmasq.d/adList.conf"