From 556799428ce6ed9ef41f2429c7bdd2470757f431 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Tue, 26 Jan 2016 20:22:29 +0000 Subject: [PATCH 1/8] Contains default adlists. --- adlists.default | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 adlists.default diff --git a/adlists.default b/adlists.default new file mode 100644 index 00000000..d603c5f0 --- /dev/null +++ b/adlists.default @@ -0,0 +1,8 @@ +https://adaway.org/hosts.txt +http://adblock.gjtech.net/?format=unix-hosts +http://hosts-file.net/ad_servers.txt +http://www.malwaredomainlist.com/hostslist/hosts.txt +http://pgl.yoyo.org/adservers/serverlist.php? +http://someonewhocares.org/hosts/hosts +http://winhelp2002.mvps.org/hosts.txt +http://mirror1.malwaredomains.com/files/justdomains \ No newline at end of file From 352ebc3193d17ae4e075eec7f71bfe909ab8fa06 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Tue, 26 Jan 2016 20:26:09 +0000 Subject: [PATCH 2/8] outsource list of adlists to a file in /etc/pihole/. --- gravity.sh | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/gravity.sh b/gravity.sh index 5097e050..5fbcc82f 100755 --- a/gravity.sh +++ b/gravity.sh @@ -29,6 +29,9 @@ fi piholeIPfile=/tmp/piholeIP piholeIPv6file=/etc/pihole/.useIPv6 +adListFile=/etc/pihole/adlists.list +adListDefault=/etc/pihole/adlists.default + if [[ -f $piholeIPfile ]];then # If the file exists, it means it was exported from the installation script and we should use that value instead of detecting it in this script piholeIP=$(cat $piholeIPfile) @@ -45,18 +48,8 @@ if [[ -f $piholeIPv6file ]];then piholeIPv6=$(ip -6 route get 2001:4860:4860::8888 | awk -F " " '{ for(i=1;i<=NF;i++) if ($i == "src") print $(i+1) }') fi -# Ad-list sources--one per line in single quotes -# The mahakala source is commented out due to many users having issues with it blocking legitimate domains. -# Uncomment at your own risk -sources=('https://adaway.org/hosts.txt' -'http://adblock.gjtech.net/?format=unix-hosts' -#'http://adblock.mahakala.is/' -'http://hosts-file.net/ad_servers.txt' -'http://www.malwaredomainlist.com/hostslist/hosts.txt' -'http://pgl.yoyo.org/adservers/serverlist.php?' -'http://someonewhocares.org/hosts/hosts' -'http://winhelp2002.mvps.org/hosts.txt' -'http://mirror1.malwaredomains.com/files/justdomains') + + # Variables for various stages of downloading and formatting the list basename=pihole @@ -97,7 +90,26 @@ spinner(){ ########################### # collapse - begin formation of pihole function gravity_collapse() { - echo -n "::: Neutrino emissions detected..." + echo "::: Neutrino emissions detected..." + echo ":::" + #Decide if we're using a custom ad block list, or defaults. + if [ -f $adListFile ]; then + #custom file found, use this instead of default + echo -n "::: Custom adList file detected. Reading..." + sources=() + while read -a line; do + sources+=($line) + done < $adListFile + echo " done!" + else + #no custom file found, use defaults! + echo -n "::: No custom adlist file detected, reading from default file..." + sources=() + while read -a line; do + sources+=($line) + done < $adListDefault + echo " done!" + fi # Create the pihole resource directory if it doesn't exist. Future files will be stored here if [[ -d $piholeDir ]];then From ef99fe2d18f4dbc1812af4b22de47527a2346752 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Tue, 26 Jan 2016 20:33:49 +0000 Subject: [PATCH 3/8] Add line to copy default ad list into /etc/pihole --- automated install/basic-install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index a8676721..dfe279a9 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -434,6 +434,7 @@ runGravity(){ $SUDO echo "::: Preparing to run gravity.sh to refresh hosts..." if ls /etc/pihole/list* 1> /dev/null 2>&1; then echo "::: Cleaning up previous install (preserving whitelist/blacklist)" + $SUDO cp -o /etc/.pihole/adlists.default /etc/pihole/adlists.default $SUDO rm /etc/pihole/list.* fi #Don't run as SUDO, this was causing issues From 4a61b80dd6a43f9a3837eb26cf5e64f1c37e4019 Mon Sep 17 00:00:00 2001 From: PromoFaux Date: Tue, 26 Jan 2016 23:14:38 +0000 Subject: [PATCH 4/8] Update adlists.default Add new line to end of file.. Github was complaining --- adlists.default | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adlists.default b/adlists.default index d603c5f0..dd391357 100644 --- a/adlists.default +++ b/adlists.default @@ -5,4 +5,4 @@ http://www.malwaredomainlist.com/hostslist/hosts.txt http://pgl.yoyo.org/adservers/serverlist.php? http://someonewhocares.org/hosts/hosts http://winhelp2002.mvps.org/hosts.txt -http://mirror1.malwaredomains.com/files/justdomains \ No newline at end of file +http://mirror1.malwaredomains.com/files/justdomains From b1bd56cd517898d6bab51abbcb9adc72559500b2 Mon Sep 17 00:00:00 2001 From: PromoFaux Date: Wed, 27 Jan 2016 09:47:28 +0000 Subject: [PATCH 5/8] Update basic-install.sh --- automated install/basic-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index dfe279a9..29d0cec6 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -434,7 +434,7 @@ runGravity(){ $SUDO echo "::: Preparing to run gravity.sh to refresh hosts..." if ls /etc/pihole/list* 1> /dev/null 2>&1; then echo "::: Cleaning up previous install (preserving whitelist/blacklist)" - $SUDO cp -o /etc/.pihole/adlists.default /etc/pihole/adlists.default + $SUDO cp /etc/.pihole/adlists.default /etc/pihole/adlists.default $SUDO rm /etc/pihole/list.* fi #Don't run as SUDO, this was causing issues From 701ae06e4aa17c89f02703e1937cdadd56825399 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Wed, 27 Jan 2016 21:14:06 +0000 Subject: [PATCH 6/8] Move copying of adlists.default to gravity.sh --- automated install/basic-install.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index dfe279a9..39a043d9 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -431,10 +431,9 @@ installCron(){ runGravity(){ $SUDO echo ":::" - $SUDO echo "::: Preparing to run gravity.sh to refresh hosts..." + $SUDO echo "::: Preparing to run gravity.sh to refresh hosts..." if ls /etc/pihole/list* 1> /dev/null 2>&1; then - echo "::: Cleaning up previous install (preserving whitelist/blacklist)" - $SUDO cp -o /etc/.pihole/adlists.default /etc/pihole/adlists.default + echo "::: Cleaning up previous install (preserving whitelist/blacklist)" $SUDO rm /etc/pihole/list.* fi #Don't run as SUDO, this was causing issues From b75b290351f60f694a95b75211e5aeb9dc558ced Mon Sep 17 00:00:00 2001 From: Promofaux Date: Wed, 27 Jan 2016 21:14:23 +0000 Subject: [PATCH 7/8] adlists.default copied on each run of gravity. In case it has been overwritten --- gravity.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gravity.sh b/gravity.sh index 5fbcc82f..11689479 100755 --- a/gravity.sh +++ b/gravity.sh @@ -331,7 +331,7 @@ function gravity_reload() { echo " done!" } - +$SUDO cp -o /etc/.pihole/adlists.default /etc/pihole/adlists.default gravity_collapse gravity_spinup gravity_Schwarzchild From 5111880edfe44447dc7ea92b8e56d06933086918 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Wed, 27 Jan 2016 22:35:52 +0000 Subject: [PATCH 8/8] remove erroneous -o --- gravity.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gravity.sh b/gravity.sh index 11689479..3004b8a2 100755 --- a/gravity.sh +++ b/gravity.sh @@ -331,7 +331,7 @@ function gravity_reload() { echo " done!" } -$SUDO cp -o /etc/.pihole/adlists.default /etc/pihole/adlists.default +$SUDO cp /etc/.pihole/adlists.default /etc/pihole/adlists.default gravity_collapse gravity_spinup gravity_Schwarzchild