From 7273512de48e619d2467b37ffb036f9256504cc1 Mon Sep 17 00:00:00 2001 From: borekon Date: Mon, 12 Jun 2023 09:56:09 +0000 Subject: [PATCH] =?UTF-8?q?A=C3=B1adir=20'adblock=5Ftest.sh'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- adblock_test.sh | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 adblock_test.sh diff --git a/adblock_test.sh b/adblock_test.sh new file mode 100644 index 0000000..d184d9d --- /dev/null +++ b/adblock_test.sh @@ -0,0 +1,41 @@ +#!/bin/bash +RED='\033[1;31m' +GREEN='\033[1;32m' +BLUE='\033[1;35m' +YELLOW='\033[1;33m' +NC='\033[0m' +ip_to_find="0.0.0.0" +blocked=0 +rojo(){ + echo -e "${RED}$1${NC}" +} +amarillo(){ + echo -e "${YELLOW}$1${NC}" +} +verde(){ + echo -e "${GREEN}$1${NC}" +} +azul(){ + echo -e "${BLUE}$1${NC}" +} + +if [ -z "$1" ] + then + dns="127.0.0.1" + else + dns=$1 +fi +domains=$(curl -s https://raw.githubusercontent.com/StevenBlack/hosts/master/data/StevenBlack/hosts | 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" \ No newline at end of file