remove CIDR from IPs

This commit is contained in:
Tommy Huff 2016-10-19 14:49:03 -04:00
parent 67f553a7f2
commit b2134b8fde
2 changed files with 11 additions and 12 deletions

View file

@ -97,10 +97,10 @@ ModifyHostFile(){
echo ":::" echo ":::"
echo -n "::: Modifying HOSTS file to blacklist $numberOf domain${plural}..." echo -n "::: Modifying HOSTS file to blacklist $numberOf domain${plural}..."
if [[ -n "${IPv6_address}" ]] ; then if [[ -n "${IPv6_address}" ]] ; then
sed "s/^/${IPv6_address} /g" ${blacklist} >> ${adList} sed "s/^/$IPv6_address /g" ${blacklist} >> ${adList}
fi fi
if [[ -n "${IPv4_address}" ]] ; then if [[ -n "${IPv4_address}" ]] ; then
sed "s/^/${IPv4_address} /g" ${blacklist} >> ${adList} sed "s/^/$IPv4_address /g" ${blacklist} >> ${adList}
fi fi
fi fi
else else
@ -198,11 +198,10 @@ else
fi fi
if [[ -n "${IPv6_address}" ]] ; then if [[ -n "${IPv6_address}" ]] ; then
piholeIP=${IPv6_address} IPv6_address=$(echo "${IPv6_address}" | cut -f1 -d"/")
piholeIP=$(echo "${piholeIP}" | cut -f1 -d"/") fi
else if [[ -n "${IPv6_address}" ]] ; then
piholeIP=${IPv4_address} IPv4_address=$(echo "${IPv4_address}" | cut -f1 -d"/")
piholeIP=$(echo "${piholeIP}" | cut -f1 -d"/")
fi fi

View file

@ -209,12 +209,12 @@ else
exit 1 exit 1
fi fi
#remove CIDR from IPs
if [[ -n "${IPv6_address}" ]] ; then if [[ -n "${IPv6_address}" ]] ; then
piholeIP=${IPv6_address} IPv6_address=$(echo "${IPv6_address}" | cut -f1 -d"/")
piholeIP=$(echo "${piholeIP}" | cut -f1 -d"/") fi
else if [[ -n "${IPv6_address}" ]] ; then
piholeIP=${IPv4_address} IPv4_address=$(echo "${IPv4_address}" | cut -f1 -d"/")
piholeIP=$(echo "${piholeIP}" | cut -f1 -d"/")
fi fi
PopWhitelistFile PopWhitelistFile