From a8ac212ee627f0f72aad5e65322541c4b265e5a6 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sun, 29 Jan 2017 13:46:27 +0100 Subject: [PATCH] Show number of wildcard blocked domains in gravity's summary --- gravity.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/gravity.sh b/gravity.sh index b1cd57a6..31bc6bd0 100755 --- a/gravity.sh +++ b/gravity.sh @@ -32,6 +32,7 @@ adListDefault=/etc/pihole/adlists.default whitelistScript="pihole -w" whitelistFile=/etc/pihole/whitelist.txt blacklistFile=/etc/pihole/blacklist.txt +readonly wildcardlist="/etc/dnsmasq.d/03-pihole-wildcard.conf" #Source the setupVars from install script for the IP setupVars=/etc/pihole/setupVars.conf @@ -235,6 +236,21 @@ gravity_Blacklist() { } +gravity_Wildcard() { + # Return number of wildcards in output - don't actually handle wildcards + if [[ -f "${wildcardlist}" ]]; then + num=$(grep -c ^ "${wildcardlist}") + if [[ -n "${IPV4_ADDRESS}" && -n "${IPV6_ADDRESS}" ]];then + let num/=2 + fi + plural=; [[ "$num" != "1" ]] && plural=s + echo "::: Wildcard blocked domain${plural}: $numBlacklisted" + else + echo "::: No wildcards used!" + fi + +} + gravity_Whitelist() { #${piholeDir}/${eventHorizon}) echo ":::" @@ -401,6 +417,7 @@ else fi gravity_Whitelist gravity_Blacklist +gravity_Wildcard gravity_hostFormat gravity_blackbody