scripts/adblock_test.sh

28 lines
679 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"
blocked=0
if [ -z "$1" ]
then
#dns="127.0.0.1"
dns=$(cat /etc/resolv.conf | grep ^nameserver | cut -d " " -f 2)
else
dns=$1
fi
domains=$(curl -s https://raw.githubusercontent.com/StevenBlack/hosts/master/data/StevenBlack/hosts | grep -v ^# | shuf -n 10 | cut -d" " -f2)
for j in $domains; do
echo -e "${YELLOW}$j${NC}:"
output=$(dig @$dns $j +short)
if [[ "$output" == *"$ip_to_find"* ]]; then
verde $output
((blocked++))
else
rojo $output
fi
echo ""
done;
porcentaje=$(( blocked * 10 ))
azul "$porcentaje % dominios bloqueados"