From 3e5c6afaee2755503ce1e7124d0413e44f496e6c Mon Sep 17 00:00:00 2001 From: Gusher123 <31935813+Gusher123@users.noreply.github.com> Date: Sat, 11 Aug 2018 14:33:33 +0200 Subject: [PATCH] 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) --- gravity.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/gravity.sh b/gravity.sh index 50c37784..a9136990 100755 --- a/gravity.sh +++ b/gravity.sh @@ -217,6 +217,17 @@ gravity_DownloadBlocklistFromUrl() { str="Status:" echo -ne " ${INFO} ${str} Pending..." # 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) case $url in