Don't let one blocklist, block an other

If a blocklist is blocked by an other and 'pihole -g' is run, update the blocked blocklist by useing an alternate dns server (in this case 1.1.1.1) to acquire the IP adres and download the blocklist using the 'curl --resolve' (https://curl.haxx.se/docs/manpage.html#--resolve)
This commit is contained in:
Gusher123 2018-08-11 14:33:33 +02:00 committed by GitHub
parent ddbdb51d20
commit 3e5c6afaee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -217,6 +217,17 @@ gravity_DownloadBlocklistFromUrl() {
str="Status:" str="Status:"
echo -ne " ${INFO} ${str} Pending..." echo -ne " ${INFO} ${str} Pending..."
# shellcheck disable=SC2086 # shellcheck disable=SC2086
if [ `dig $domain +short | grep 0.0.0.0 -c` -ge 1 ]; then
ip=`dig @1.1.1.1 +short $domain`
if [ `echo $url | awk -F '://' '{print $1}'` = "https" ]; then
port=443;
else
port=80
fi
echo -e "${OVER} ${CROSS} ${str} ${domain} is currently blocked by pi-hole. Circumventing pi-hole and trying again";
echo -ne " ${INFO} ${str} Pending..."
cmd_ext="--resolve $domain:$port:$ip $cmd_ext"
fi
httpCode=$(curl -s -L ${cmd_ext} ${heisenbergCompensator} -w "%{http_code}" -A "${agent}" "${url}" -o "${patternBuffer}" 2> /dev/null) httpCode=$(curl -s -L ${cmd_ext} ${heisenbergCompensator} -w "%{http_code}" -A "${agent}" "${url}" -o "${patternBuffer}" 2> /dev/null)
case $url in case $url in