From b7278ccf849ace299ddb745bffbc4498b6d15fe2 Mon Sep 17 00:00:00 2001 From: arymaynart Date: Sat, 26 Jul 2025 11:39:22 -0300 Subject: [PATCH] Add file to blacklist_hosts Add the possibility to work with a file list of domains. --- postwhite | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/postwhite b/postwhite index fab86bb..fc2e084 100755 --- a/postwhite +++ b/postwhite @@ -260,11 +260,22 @@ if [ x"$include_yahoo" = x"yes" ] ; then fi if [ x"$enable_blacklist" = x"yes" ] ; then - printf "\nQuerying blacklist hosts...\n" - - for h in ${blacklist_hosts}; do - query_black_host "${h}" - done + printf "\nQuerying blacklist hosts...\n" + + for h in ${blacklist_hosts}; do + query_black_host "${h}" + done + + # Read domains from file if defined + if [ -n "$blacklist_hosts_file" ] && [ -f "$blacklist_hosts_file" ]; then + while IFS= read -r h; do + # Ignore coments + [ -z "$h" ] && continue + echo "$h" | grep -q '^#' && continue + + query_black_host "$h" + done < "$blacklist_hosts_file" + fi fi # If enabled, simplify (remove) any individual IPs already included in CIDR ranges (disabled by default)