mirror of
https://github.com/pi-hole/pi-hole
synced 2025-01-03 12:40:56 +00:00
Merge branch 'development' into BugFix463
Conflicts: advanced/Scripts/blacklist.sh advanced/Scripts/whitelist.sh
This commit is contained in:
commit
619082dbed
@ -48,3 +48,6 @@ https://raw.githubusercontent.com/quidsup/notrack/master/trackers.txt
|
|||||||
#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
|
||||||
#http://spam404bl.com/spam404scamlist.txt
|
#http://spam404bl.com/spam404scamlist.txt
|
||||||
#http://malwaredomains.lehigh.edu/files/domains.txt
|
#http://malwaredomains.lehigh.edu/files/domains.txt
|
||||||
|
# Following two lists should be used simultaneously: (readme https://github.com/notracking/hosts-blocklists/)
|
||||||
|
#https://raw.github.com/notracking/hosts-blocklists/master/hostnames.txt
|
||||||
|
#https://raw.github.com/notracking/hosts-blocklists/master/domains.txt
|
||||||
|
@ -80,6 +80,10 @@ function helpFunc()
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if [[ $# = 0 ]]; then
|
||||||
|
helpFunc
|
||||||
|
fi
|
||||||
|
|
||||||
function HandleOther(){
|
function HandleOther(){
|
||||||
#check validity of domain
|
#check validity of domain
|
||||||
validDomain=$(echo "$1" | perl -ne'print if /\b((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63}\b/')
|
validDomain=$(echo "$1" | perl -ne'print if /\b((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63}\b/')
|
||||||
|
@ -19,6 +19,7 @@ DEBUG_LOG="/var/log/pihole_debug.log"
|
|||||||
DNSMASQFILE="/etc/dnsmasq.conf"
|
DNSMASQFILE="/etc/dnsmasq.conf"
|
||||||
PIHOLECONFFILE="/etc/dnsmasq.d/01-pihole.conf"
|
PIHOLECONFFILE="/etc/dnsmasq.d/01-pihole.conf"
|
||||||
LIGHTTPDFILE="/etc/lighttpd/lighttpd.conf"
|
LIGHTTPDFILE="/etc/lighttpd/lighttpd.conf"
|
||||||
|
LIGHTTPDERRFILE="/var/log/lighttpd/error.log"
|
||||||
GRAVITYFILE="/etc/pihole/gravity.list"
|
GRAVITYFILE="/etc/pihole/gravity.list"
|
||||||
HOSTSFILE="/etc/hosts"
|
HOSTSFILE="/etc/hosts"
|
||||||
WHITELISTFILE="/etc/pihole/whitelist.txt"
|
WHITELISTFILE="/etc/pihole/whitelist.txt"
|
||||||
@ -53,6 +54,19 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
### Private functions exist here ###
|
### Private functions exist here ###
|
||||||
|
function versionCheck {
|
||||||
|
echo "#######################################" >> $DEBUG_LOG
|
||||||
|
echo "########## Versions Section ###########" >> $DEBUG_LOG
|
||||||
|
echo "#######################################" >> $DEBUG_LOG
|
||||||
|
|
||||||
|
TMP=$(cd /etc/.pihole/ && git describe --tags --abbrev=0)
|
||||||
|
echo "Pi-hole Version: $TMP" >> $DEBUG_LOG
|
||||||
|
|
||||||
|
TMP=$(cd /var/www/html/admin && git describe --tags --abbrev=0)
|
||||||
|
echo "WebUI Version: $TMP" >> $DEBUG_LOG
|
||||||
|
echo >> $DEBUG_LOG
|
||||||
|
}
|
||||||
|
|
||||||
function compareWhitelist {
|
function compareWhitelist {
|
||||||
if [ ! -f "$WHITELISTMATCHES" ]; then
|
if [ ! -f "$WHITELISTMATCHES" ]; then
|
||||||
$SUDO touch $WHITELISTMATCHES
|
$SUDO touch $WHITELISTMATCHES
|
||||||
@ -126,12 +140,44 @@ function checkProcesses {
|
|||||||
for i in "${PROCESSES[@]}"
|
for i in "${PROCESSES[@]}"
|
||||||
do
|
do
|
||||||
echo "" >> $DEBUG_LOG
|
echo "" >> $DEBUG_LOG
|
||||||
echo -n $i >> "$DEBUG_LOG"
|
echo -n "$i" >> "$DEBUG_LOG"
|
||||||
echo " processes status:" >> $DEBUG_LOG
|
echo " processes status:" >> $DEBUG_LOG
|
||||||
$SUDO systemctl -l status $i >> "$DEBUG_LOG"
|
$SUDO systemctl -l status "$i" >> "$DEBUG_LOG"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function debugLighttpd {
|
||||||
|
echo "::: Writing lighttpd to debug log..."
|
||||||
|
echo "#######################################" >> $DEBUG_LOG
|
||||||
|
echo "############ lighttpd.conf ############" >> $DEBUG_LOG
|
||||||
|
echo "#######################################" >> $DEBUG_LOG
|
||||||
|
if [ -e "$LIGHTTPDFILE" ]
|
||||||
|
then
|
||||||
|
while read -r line; do
|
||||||
|
if [ ! -z "$line" ]; then
|
||||||
|
[[ "$line" =~ ^#.*$ ]] && continue
|
||||||
|
echo "$line" >> $DEBUG_LOG
|
||||||
|
fi
|
||||||
|
done < "$LIGHTTPDFILE"
|
||||||
|
echo >> $DEBUG_LOG
|
||||||
|
else
|
||||||
|
echo "No lighttpd.conf file found!" >> $DEBUG_LOG
|
||||||
|
printf ":::\tNo lighttpd.conf file found\n"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -e "$LIGHTTPDERRFILE" ]
|
||||||
|
then
|
||||||
|
echo "#######################################" >> $DEBUG_LOG
|
||||||
|
echo "######### lighttpd error.log ##########" >> $DEBUG_LOG
|
||||||
|
echo "#######################################" >> $DEBUG_LOG
|
||||||
|
cat "$LIGHTTPDERRFILE" >> $DEBUG_LOG
|
||||||
|
else
|
||||||
|
echo "No lighttpd error.log file found!" >> $DEBUG_LOG
|
||||||
|
printf ":::\tNo lighttpd error.log file found\n"
|
||||||
|
fi
|
||||||
|
echo >> $DEBUG_LOG
|
||||||
|
}
|
||||||
|
|
||||||
### END FUNCTIONS ###
|
### END FUNCTIONS ###
|
||||||
|
|
||||||
### Check Pi internet connections ###
|
### Check Pi internet connections ###
|
||||||
@ -148,10 +194,12 @@ echo "Gateway check:" >> $DEBUG_LOG
|
|||||||
echo "$GATEWAY_CHECK" >> $DEBUG_LOG
|
echo "$GATEWAY_CHECK" >> $DEBUG_LOG
|
||||||
echo >> $DEBUG_LOG
|
echo >> $DEBUG_LOG
|
||||||
|
|
||||||
|
versionCheck
|
||||||
compareWhitelist
|
compareWhitelist
|
||||||
compareBlacklist
|
compareBlacklist
|
||||||
testNslookup
|
testNslookup
|
||||||
checkProcesses
|
checkProcesses
|
||||||
|
debugLighttpd
|
||||||
|
|
||||||
echo "::: Writing dnsmasq.conf to debug log..."
|
echo "::: Writing dnsmasq.conf to debug log..."
|
||||||
echo "#######################################" >> $DEBUG_LOG
|
echo "#######################################" >> $DEBUG_LOG
|
||||||
@ -178,7 +226,6 @@ echo "########### 01-pihole.conf ############" >> $DEBUG_LOG
|
|||||||
echo "#######################################" >> $DEBUG_LOG
|
echo "#######################################" >> $DEBUG_LOG
|
||||||
if [ -e "$PIHOLECONFFILE" ]
|
if [ -e "$PIHOLECONFFILE" ]
|
||||||
then
|
then
|
||||||
#cat "$PIHOLECONFFILE" >> $DEBUG_LOG
|
|
||||||
while read -r line; do
|
while read -r line; do
|
||||||
if [ ! -z "$line" ]; then
|
if [ ! -z "$line" ]; then
|
||||||
[[ "$line" =~ ^#.*$ ]] && continue
|
[[ "$line" =~ ^#.*$ ]] && continue
|
||||||
@ -191,25 +238,6 @@ else
|
|||||||
printf ":::\tNo 01-pihole.conf file found\n"
|
printf ":::\tNo 01-pihole.conf file found\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "::: Writing lighttpd.conf to debug log..."
|
|
||||||
echo "#######################################" >> $DEBUG_LOG
|
|
||||||
echo "############ lighttpd.conf ############" >> $DEBUG_LOG
|
|
||||||
echo "#######################################" >> $DEBUG_LOG
|
|
||||||
if [ -e "$LIGHTTPDFILE" ]
|
|
||||||
then
|
|
||||||
#cat "$PIHOLECONFFILE" >> $DEBUG_LOG
|
|
||||||
while read -r line; do
|
|
||||||
if [ ! -z "$line" ]; then
|
|
||||||
[[ "$line" =~ ^#.*$ ]] && continue
|
|
||||||
echo "$line" >> $DEBUG_LOG
|
|
||||||
fi
|
|
||||||
done < "$LIGHTTPDFILE"
|
|
||||||
echo >> $DEBUG_LOG
|
|
||||||
else
|
|
||||||
echo "No lighttpd.conf file found!" >> $DEBUG_LOG
|
|
||||||
printf ":::\tNo lighttpd.conf file found\n"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "::: Writing size of gravity.list to debug log..."
|
echo "::: Writing size of gravity.list to debug log..."
|
||||||
echo "#######################################" >> $DEBUG_LOG
|
echo "#######################################" >> $DEBUG_LOG
|
||||||
echo "############ gravity.list #############" >> $DEBUG_LOG
|
echo "############ gravity.list #############" >> $DEBUG_LOG
|
||||||
@ -283,7 +311,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 {
|
function dumpPiHoleLog {
|
||||||
trap '{ echo -e "\nFinishing 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 pihole 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 pihole 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
|
||||||
echo "############# pihole.log ##############" >> $DEBUG_LOG
|
echo "############# pihole.log ##############" >> $DEBUG_LOG
|
||||||
@ -302,7 +330,8 @@ function dumpPiHoleLog {
|
|||||||
|
|
||||||
# Anything to be done after capturing of pihole.log terminates
|
# Anything to be done after capturing of pihole.log terminates
|
||||||
function finalWork {
|
function finalWork {
|
||||||
echo "::: Finshed debugging!"
|
echo "::: Finshed debugging!"
|
||||||
|
echo "::: Debug log can be found at : /var/log/pihole_debug.log"
|
||||||
}
|
}
|
||||||
trap finalWork EXIT
|
trap finalWork EXIT
|
||||||
|
|
||||||
|
@ -79,6 +79,10 @@ function helpFunc()
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if [[ $# = 0 ]]; then
|
||||||
|
helpFunc
|
||||||
|
fi
|
||||||
|
|
||||||
function HandleOther(){
|
function HandleOther(){
|
||||||
#check validity of domain
|
#check validity of domain
|
||||||
validDomain=$(echo "$1" | perl -ne'print if /\b((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63}\b/')
|
validDomain=$(echo "$1" | perl -ne'print if /\b((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63}\b/')
|
||||||
|
Loading…
Reference in New Issue
Block a user