#!/bin/bash ########################################################################### ## Copyright (C) Wizardry and Steamworks 2014 - License: GNU GPLv3 ## ## Please see: http://www.gnu.org/licenses/gpl.html for legal details, ## ## rights of fair usage, the disclaimer and warranty conditions. ## ########################################################################### if [[ -z "$1" ]]; then echo "Syntax: $0 spam_domains.txt" exit 1 fi DOMAIN_FILE="$1" # Cull dead domains. while read DOMAIN; do if [[ -z "$DOMAIN" ]]; then continue; fi DNS_LOOKUP=`nslookup -timeout=1 -retry=0 -fail $DOMAIN | grep Name` if [[ ! -z "$DNS_LOOKUP" ]]; then echo "$DOMAIN" >> /tmp/spam_domains.txt fi done < $DOMAIN_FILE # Sort and clean sort -u /tmp/spam_domains.txt > $DOMAIN_FILE rm /tmp/spam_domains.txt