Added option to specify the output filename

This commit is contained in:
borekon 2024-05-31 07:36:30 +00:00
parent 3c47ec2a74
commit eef71f01ef

View File

@ -1,19 +1,18 @@
#!/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=$(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"
echo ""
((deleted++))
else
echo $j\:$output
echo -e "0.0.0.0\t$j" >> lista.txt
echo -e "0.0.0.0\t$j" >> $archivo
((kept++))
fi
done;