scripts/domain_cleaner.sh

23 lines
673 B
Bash

#!/bin/bash
source <(curl -s https://gitea.avc.cx/borekon/scripts/raw/branch/main/colores.sh)
ip_to_find="0.0.0.0"
deleted=0
kept=0
domains=${1:-$(curl -s https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts)}
for j in $domains; do
j=$(echo $j | grep -v ^# | cut -d" " -f2)
output=$(dig @192.168.1.1 $j +short)
if [ -z "$output" ];then
rojo "$j NXDOMAIN"
echo ""
((deleted++))
else
echo $j\:$output
echo -e "0.0.0.0\t$j" >> lista.txt
((kept++))
fi
done;
amarillo "Domains kept = $kept"
amarillo "Domains deleted = $deleted"