make hosts with ivp4 and 6

This commit is contained in:
Tommy Huff 2016-10-19 14:36:43 -04:00
parent e93f8d59d9
commit 67f553a7f2
3 changed files with 20 additions and 13 deletions

View file

@ -96,7 +96,12 @@ ModifyHostFile(){
plural=; [[ "$numberOf" != "1" ]] && plural=s
echo ":::"
echo -n "::: Modifying HOSTS file to blacklist $numberOf domain${plural}..."
sed "s/^/$piholeIP /g" ${blacklist} >> ${adList}
if [[ -n "${IPv6_address}" ]] ; then
sed "s/^/${IPv6_address} /g" ${blacklist} >> ${adList}
fi
if [[ -n "${IPv4_address}" ]] ; then
sed "s/^/${IPv4_address} /g" ${blacklist} >> ${adList}
fi
fi
else
echo ":::"

View file

@ -102,7 +102,12 @@ ModifyHostFile(){
plural=; [[ "$numberOf" != "1" ]] && plural=s
echo ":::"
echo -n "::: Modifying HOSTS file to whitelist $numberOf domain${plural}..."
awk -F':' '{print $1}' ${whitelist} | while read -r line; do echo "$piholeIP $line"; done > ${piholeDir}/whitelist.tmp
if [[ -n "${IPv6_address}" ]] ; then
awk -F':' '{print $1}' ${whitelist} | while read -r line; do echo "${IPv6_address} $line"; done >> ${piholeDir}/whitelist.tmp
fi
if [[ -n "${IPv4_address}" ]] ; then
awk -F':' '{print $1}' ${whitelist} | while read -r line; do echo "${IPv4_address} $line"; done >> ${piholeDir}/whitelist.tmp
fi
echo "l" >> ${piholeDir}/whitelist.tmp
grep -F -x -v -f ${piholeDir}/whitelist.tmp ${adList} > ${piholeDir}/gravity.tmp
rm ${adList}