dns servers converted to array
In some systems could be more than one DNS server in resolv.conf. With this fix, we only pick the first element Signed-off-by: borekon <alfonso@vivancos.eu>
This commit is contained in:
parent
099718edd0
commit
16a7bee6d0
|
@ -10,12 +10,13 @@ blocked=0
|
||||||
# else
|
# else
|
||||||
# dns=$1
|
# dns=$1
|
||||||
#fi
|
#fi
|
||||||
dns=${1:-$(cat /etc/resolv.conf | grep ^nameserver | cut -d " " -f 2)}
|
dns_raw=${1:-$(cat /etc/resolv.conf | grep ^nameserver | cut -d " " -f 2)}
|
||||||
|
dns=($dns_raw)
|
||||||
domains=$(curl -s https://raw.githubusercontent.com/StevenBlack/hosts/master/data/StevenBlack/hosts | grep -v ^# | shuf -n 10 | cut -d" " -f2)
|
domains=$(curl -s https://raw.githubusercontent.com/StevenBlack/hosts/master/data/StevenBlack/hosts | grep -v ^# | shuf -n 10 | cut -d" " -f2)
|
||||||
verde "Using $dns DNS server"
|
verde "Using ${dns[0]} DNS server"
|
||||||
for j in $domains; do
|
for j in $domains; do
|
||||||
echo -e "${YELLOW}$j${NC}:"
|
echo -e "${YELLOW}$j${NC}:"
|
||||||
output=$(dig -4 @$dns $j +short)
|
output=$(dig -4 @${dns[0]} $j +short)
|
||||||
if [[ "$output" == *"$ip_to_find"* ]]; then
|
if [[ "$output" == *"$ip_to_find"* ]]; then
|
||||||
verde $output
|
verde $output
|
||||||
((blocked++))
|
((blocked++))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user