1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-12-23 07:18:07 +00:00

Merge branch 'development' into promoTweaksTheSecond

# Conflicts:
#	advanced/Scripts/blacklist.sh
#	advanced/Scripts/whitelist.sh
This commit is contained in:
Promofaux 2016-10-20 21:06:28 +01:00
commit 9ab6df0e54
10 changed files with 117 additions and 116 deletions

View File

@ -42,9 +42,6 @@ https://raw.githubusercontent.com/quidsup/notrack/master/trackers.txt
# Block the BBC News website Breaking News banner # Block the BBC News website Breaking News banner
#https://raw.githubusercontent.com/BreakingTheNews/BreakingTheNews.github.io/master/hosts #https://raw.githubusercontent.com/BreakingTheNews/BreakingTheNews.github.io/master/hosts
# List of known C&C malware servers (see https://github.com/pi-hole/pi-hole/issues/528)
https://ransomwaretracker.abuse.ch/downloads/RW_DOMBL.txt
# Untested Lists: # Untested Lists:
#https://raw.githubusercontent.com/reek/anti-adblock-killer/master/anti-adblock-killer-filters.txt #https://raw.githubusercontent.com/reek/anti-adblock-killer/master/anti-adblock-killer-filters.txt
#https://raw.githubusercontent.com/Dawsey21/Lists/master/main-blacklist.txt #https://raw.githubusercontent.com/Dawsey21/Lists/master/main-blacklist.txt

View File

@ -10,18 +10,19 @@
# the Free Software Foundation, either version 2 of the License, or # the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version. # (at your option) any later version.
helpFunc() helpFunc() {
{ cat << EOM
echo "::: Immediately blacklists one or more domains in the hosts file" ::: Immediately blacklists one or more domains in the hosts file
echo ":::" :::
echo ":::" :::
echo "::: Usage: pihole -b domain1 [domain2 ...]" ::: Usage: pihole -b domain1 [domain2 ...]
echo "::: Options:" ::: Options:
echo "::: -d, --delmode Remove domains from the blacklist" ::: -d, --delmode Remove domains from the blacklist
echo "::: -nr, --noreload Update blacklist without refreshing dnsmasq" ::: -nr, --noreload Update blacklist without refreshing dnsmasq
echo "::: -q, --quiet output is less verbose" ::: -q, --quiet output is less verbose
echo "::: -h, --help Show this help dialog" ::: -h, --help Show this help dialog
echo "::: -l, --list Display your blacklisted domains" ::: -l, --list Display your blacklisted domains
EOM
exit 1 exit 1
} }

View File

@ -122,15 +122,16 @@ normalChrono(){
} }
displayHelp() { displayHelp() {
echo "::: Displays stats about your piHole!" cat << EOM
echo ":::" ::: Displays stats about your piHole!
echo "::: Usage: sudo pihole -c [optional:-j]" :::
echo "::: Note: If no option is passed, then stats are displayed on screen, updated every 5 seconds" ::: Usage: sudo pihole -c [optional:-j]
echo ":::" ::: Note: If no option is passed, then stats are displayed on screen, updated every 5 seconds
echo "::: Options:" :::
echo "::: -j, --json output stats as JSON formatted string" ::: Options:
echo "::: -h, --help display this help text" ::: -j, --json output stats as JSON formatted string
::: -h, --help display this help text
EOM
exit 1 exit 1
} }

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash #/usr/bin/env bash
# Pi-hole: A black hole for Internet advertisements # Pi-hole: A black hole for Internet advertisements
# (c) 2015, 2016 by Jacob Salmela # (c) 2015, 2016 by Jacob Salmela
# Network-wide ad blocking via your Raspberry Pi # Network-wide ad blocking via your Raspberry Pi
@ -27,12 +27,14 @@ PIHOLELOG="/var/log/pihole.log"
WHITELISTMATCHES="/tmp/whitelistmatches.list" WHITELISTMATCHES="/tmp/whitelistmatches.list"
# Header info and introduction # Header info and introduction
echo "::: Beginning Pi-hole debug at $(date)!" cat << EOM
echo "::: This debugging process will collect information from your running configuration," ::: Beginning Pi-hole debug at $(date)!
echo "::: and optionally upload the generated log to a unique and random directory on" ::: This debugging process will collect information from your running configuration,
echo "::: Termbin.com. NOTE: All log files auto-delete after 1 month and you are the only" ::: and optionally upload the generated log to a unique and random directory on
echo "::: person who is given the unique URL. Please consider where you post this link." ::: Termbin.com. NOTE: All log files auto-delete after 1 month and you are the only
echo "::: " ::: person who is given the unique URL. Please consider where you post this link.
:::
EOM
######## FIRST CHECK ######## ######## FIRST CHECK ########
@ -61,11 +63,11 @@ else
fi fi
### Private functions exist here ### ### Private functions exist here ###
function log_write { log_write() {
echo "$1" >> "${DEBUG_LOG}" echo "$1" >> "${DEBUG_LOG}"
} }
function version_check { version_check() {
log_write "############################################################" log_write "############################################################"
log_write "########## Installed Versions ##########" log_write "########## Installed Versions ##########"
log_write "############################################################" log_write "############################################################"
@ -83,7 +85,7 @@ function version_check {
php_ver="$(php -v |& head -n1)" && log_write "${php_ver}" || log_write "PHP not installed." php_ver="$(php -v |& head -n1)" && log_write "${php_ver}" || log_write "PHP not installed."
} }
function distro_check { distro_check() {
echo "############################################################" >> ${DEBUG_LOG} echo "############################################################" >> ${DEBUG_LOG}
echo "######## Installed OS Distribution #########" >> ${DEBUG_LOG} echo "######## Installed OS Distribution #########" >> ${DEBUG_LOG}
echo "############################################################" >> ${DEBUG_LOG} echo "############################################################" >> ${DEBUG_LOG}
@ -96,7 +98,7 @@ function distro_check {
echo >> ${DEBUG_LOG} echo >> ${DEBUG_LOG}
} }
function ip_check { ip_check() {
echo "############################################################" >> ${DEBUG_LOG} echo "############################################################" >> ${DEBUG_LOG}
echo "######## IP Address Information #########" >> ${DEBUG_LOG} echo "######## IP Address Information #########" >> ${DEBUG_LOG}
echo "############################################################" >> ${DEBUG_LOG} echo "############################################################" >> ${DEBUG_LOG}
@ -166,7 +168,7 @@ function ip_check {
echo >> ${DEBUG_LOG} echo >> ${DEBUG_LOG}
} }
function hostnameCheck { hostnameCheck() {
echo "############################################################" >> ${DEBUG_LOG} echo "############################################################" >> ${DEBUG_LOG}
echo "######## Hostname Information #########" >> ${DEBUG_LOG} echo "######## Hostname Information #########" >> ${DEBUG_LOG}
echo "############################################################" >> ${DEBUG_LOG} echo "############################################################" >> ${DEBUG_LOG}
@ -188,7 +190,7 @@ function hostnameCheck {
fi fi
} }
function portCheck { portCheck() {
echo "############################################################" >> ${DEBUG_LOG} echo "############################################################" >> ${DEBUG_LOG}
echo "######## Open Port Information #########" >> ${DEBUG_LOG} echo "######## Open Port Information #########" >> ${DEBUG_LOG}
echo "############################################################" >> ${DEBUG_LOG} echo "############################################################" >> ${DEBUG_LOG}
@ -200,7 +202,7 @@ function portCheck {
echo >> ${DEBUG_LOG} echo >> ${DEBUG_LOG}
} }
function testResolver { testResolver() {
echo "############################################################" >> ${DEBUG_LOG} echo "############################################################" >> ${DEBUG_LOG}
echo "############ Resolver Functions Check ############" >> ${DEBUG_LOG} echo "############ Resolver Functions Check ############" >> ${DEBUG_LOG}
echo "############################################################" >> ${DEBUG_LOG} echo "############################################################" >> ${DEBUG_LOG}
@ -262,7 +264,7 @@ function testResolver {
echo >> ${DEBUG_LOG} echo >> ${DEBUG_LOG}
} }
function checkProcesses { checkProcesses() {
echo "#######################################" >> ${DEBUG_LOG} echo "#######################################" >> ${DEBUG_LOG}
echo "########### Processes Check ###########" >> ${DEBUG_LOG} echo "########### Processes Check ###########" >> ${DEBUG_LOG}
echo "#######################################" >> ${DEBUG_LOG} echo "#######################################" >> ${DEBUG_LOG}
@ -279,7 +281,7 @@ function checkProcesses {
echo >> ${DEBUG_LOG} echo >> ${DEBUG_LOG}
} }
function debugLighttpd { debugLighttpd() {
echo "::: Writing lighttpd to debug log..." echo "::: Writing lighttpd to debug log..."
echo "#######################################" >> ${DEBUG_LOG} echo "#######################################" >> ${DEBUG_LOG}
echo "############ lighttpd.conf ############" >> ${DEBUG_LOG} echo "############ lighttpd.conf ############" >> ${DEBUG_LOG}
@ -420,7 +422,7 @@ fi
# Continuously append the pihole.log file to the pihole_debug.log file # Continuously append the pihole.log file to the pihole_debug.log file
function dumpPiHoleLog { dumpPiHoleLog() {
trap '{ echo -e "\n::: Finishing debug write from interrupt... Quitting!" ; exit 1; }' INT trap '{ echo -e "\n::: Finishing debug write from interrupt... Quitting!" ; exit 1; }' INT
echo -e "::: Writing current Pi-hole traffic to debug log...\n:::\tTry loading any/all sites that you are having trouble with now... \n:::\t(Press ctrl+C to finish)" echo -e "::: Writing current Pi-hole traffic to debug log...\n:::\tTry loading any/all sites that you are having trouble with now... \n:::\t(Press ctrl+C to finish)"
echo "#######################################" >> ${DEBUG_LOG} echo "#######################################" >> ${DEBUG_LOG}
@ -439,7 +441,7 @@ function dumpPiHoleLog {
} }
# Anything to be done after capturing of pihole.log terminates # Anything to be done after capturing of pihole.log terminates
function finalWork { finalWork() {
echo "::: Finshed debugging!" echo "::: Finshed debugging!"
echo "::: The debug log can be uploaded to Termbin.com for easier sharing." echo "::: The debug log can be uploaded to Termbin.com for easier sharing."
read -r -p "::: Would you like to upload the log? [y/N] " response read -r -p "::: Would you like to upload the log? [y/N] " response

View File

@ -17,8 +17,7 @@ webInterfaceDir="/var/www/html/admin"
piholeGitUrl="https://github.com/pi-hole/pi-hole.git" piholeGitUrl="https://github.com/pi-hole/pi-hole.git"
piholeFilesDir="/etc/.pihole" piholeFilesDir="/etc/.pihole"
spinner() spinner() {
{
local pid=$1 local pid=$1
local delay=0.50 local delay=0.50
local spinstr='/-\|' local spinstr='/-\|'

View File

@ -71,21 +71,22 @@ coreOutput(){
fi fi
} }
helpFunc() helpFunc() {
{ cat << EOM
echo ":::" :::
echo "::: Show Pi-hole/Web Admin versions" ::: Show Pi-hole/Web Admin versions
echo ":::" :::
echo "::: Usage: pihole -v [ -a | -p ] [ -l | -c ]" ::: Usage: pihole -v [ -a | -p ] [ -l | -c ]
echo ":::" :::
echo "::: Options:" ::: Options:
echo "::: -a, --admin Show both current and latest versions of web admin" ::: -a, --admin Show both current and latest versions of web admin
echo "::: -p, --pihole Show both current and latest versions of Pi-hole core files" ::: -p, --pihole Show both current and latest versions of Pi-hole core files
echo "::: -l, --latest (Only after -a | -p) Return only latest version" ::: -l, --latest (Only after -a | -p) Return only latest version
echo "::: -c, --current (Only after -a | -p) Return only current version" ::: -c, --current (Only after -a | -p) Return only current version
echo "::: -h, --help Show this help dialog" ::: -h, --help Show this help dialog
echo ":::" :::
exit 0 EOM
exit 1
} }
if [[ $# = 0 ]]; then if [[ $# = 0 ]]; then

View File

@ -11,18 +11,19 @@
# (at your option) any later version. # (at your option) any later version.
helpFunc() helpFunc() {
{ cat << EOM
echo "::: Immediately whitelists one or more domains in the hosts file" ::: Immediately whitelists one or more domains in the hosts file
echo ":::" :::
echo "::: Usage: pihole -w domain1 [domain2 ...]" ::: Usage: pihole -w domain1 [domain2 ...]
echo ":::" :::
echo "::: Options:" ::: Options:
echo "::: -d, --delmode Remove domains from the whitelist" ::: -d, --delmode Remove domains from the whitelist
echo "::: -nr, --noreload Update Whitelist without refreshing dnsmasq" ::: -nr, --noreload Update Whitelist without refreshing dnsmasq
echo "::: -q, --quiet output is less verbose" ::: -q, --quiet output is less verbose
echo "::: -h, --help Show this help dialog" ::: -h, --help Show this help dialog
echo "::: -l, --list Display your whitelisted domains" ::: -l, --list Display your whitelisted domains
EOM
exit 1 exit 1
} }
@ -139,3 +140,4 @@ if ${reload}; then
fi fi

View File

@ -121,8 +121,7 @@ else
fi fi
####### FUNCTIONS ########## ####### FUNCTIONS ##########
spinner() spinner() {
{
local pid=$1 local pid=$1
local delay=0.50 local delay=0.50
local spinstr='/-\|' local spinstr='/-\|'
@ -389,8 +388,7 @@ setStaticIPv4() {
fi fi
} }
function valid_ip() valid_ip() {
{
local ip=$1 local ip=$1
local stat=1 local stat=1

View File

@ -58,8 +58,7 @@ else
exit exit
fi fi
spinner() spinner() {
{
local pid=$1 local pid=$1
local delay=0.50 local delay=0.50
local spinstr='/-\|' local spinstr='/-\|'
@ -73,7 +72,7 @@ spinner()
printf " \b\b\b\b" printf " \b\b\b\b"
} }
function removeAndPurge { removeAndPurge() {
# Purge dependencies # Purge dependencies
echo ":::" echo ":::"
for i in "${PIHOLE_DEPS[@]}"; do for i in "${PIHOLE_DEPS[@]}"; do
@ -104,7 +103,7 @@ echo ":::"
removeNoPurge removeNoPurge
} }
function removeNoPurge { removeNoPurge() {
echo ":::" echo ":::"
# Only web directories/files that are created by pihole should be removed. # Only web directories/files that are created by pihole should be removed.
echo "::: Removing the Pi-hole Web server files..." echo "::: Removing the Pi-hole Web server files..."

View File

@ -13,15 +13,16 @@
# Run this script as root or under sudo # Run this script as root or under sudo
echo ":::" echo ":::"
helpFunc() helpFunc() {
{ cat << EOM
echo "::: Pull in domains from adlists" ::: Pull in domains from adlists
echo ":::" :::
echo "::: Usage: pihole -g" ::: Usage: pihole -g
echo ":::" :::
echo "::: Options:" ::: Options:
echo "::: -f, --force Force lists to be downloaded, even if they don't need updating." ::: -f, --force Force lists to be downloaded, even if they don't need updating.
echo "::: -h, --help Show this help dialog" ::: -h, --help Show this help dialog
EOM
exit 1 exit 1
} }