Convert whitelist and blacklist to 0.0.0.0

This commit is contained in:
Mcat12 2016-04-20 16:26:34 -04:00
parent b3376f1066
commit 615bb8f77b
2 changed files with 18 additions and 40 deletions

View file

@ -27,12 +27,8 @@ versbose=true
domList=() domList=()
domToRemoveList=() domToRemoveList=()
piholeIPv6file=/etc/pihole/.useIPv6 piholeIP="0.0.0.0"
piholeIPv6="::"
# Otherwise, the IP address can be taken directly from the machine, which will happen when the script is run by the user and not the installation script
IPv4dev=$(ip route get 8.8.8.8 | awk '{for(i=1;i<=NF;i++)if($i~/dev/)print $(i+1)}')
piholeIPCIDR=$(ip -o -f inet addr show dev "$IPv4dev" | awk '{print $4}' | awk 'END {print}')
piholeIP=${piholeIPCIDR%/*}
modifyHost=false modifyHost=false
@ -42,13 +38,6 @@ if [[ -r $piholeDir/pihole.conf ]];then
. $piholeDir/pihole.conf . $piholeDir/pihole.conf
fi fi
if [[ -f $piholeIPv6file ]];then
# If the file exists, then the user previously chose to use IPv6 in the automated installer
piholeIPv6=$(ip -6 route get 2001:4860:4860::8888 | awk -F " " '{ for(i=1;i<=NF;i++) if ($i == "src") print $(i+1) }')
fi
function helpFunc() function helpFunc()
{ {
echo "::: Immediately blacklists one or more domains in the hosts file" echo "::: Immediately blacklists one or more domains in the hosts file"

View file

@ -27,12 +27,8 @@ versbose=true
domList=() domList=()
domToRemoveList=() domToRemoveList=()
piholeIPv6file=/etc/pihole/.useIPv6 piholeIP="0.0.0.0"
piholeIPv6="::"
# Otherwise, the IP address can be taken directly from the machine, which will happen when the script is run by the user and not the installation script
IPv4dev=$(ip route get 8.8.8.8 | awk '{for(i=1;i<=NF;i++)if($i~/dev/)print $(i+1)}')
piholeIPCIDR=$(ip -o -f inet addr show dev "$IPv4dev" | awk '{print $4}' | awk 'END {print}')
piholeIP=${piholeIPCIDR%/*}
modifyHost=false modifyHost=false
@ -42,12 +38,6 @@ if [[ -r $piholeDir/pihole.conf ]];then
. $piholeDir/pihole.conf . $piholeDir/pihole.conf
fi fi
if [[ -f $piholeIPv6file ]];then
# If the file exists, then the user previously chose to use IPv6 in the automated installer
piholeIPv6=$(ip -6 route get 2001:4860:4860::8888 | awk -F " " '{ for(i=1;i<=NF;i++) if ($i == "src") print $(i+1) }')
fi
function helpFunc() function helpFunc()
{ {
echo "::: Immediately whitelists one or more domains in the hosts file" echo "::: Immediately whitelists one or more domains in the hosts file"
@ -146,7 +136,6 @@ function ModifyHostFile(){
mv $piholeDir/gravity.tmp $adList mv $piholeDir/gravity.tmp $adList
rm $piholeDir/whitelist.tmp rm $piholeDir/whitelist.tmp
echo " done!" echo " done!"
fi fi
else else
#we need to add the removed domains to the hosts file #we need to add the removed domains to the hosts file