scripts/domain_cleaner.sh

21 lines
657 B
Bash

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