Skip to content

Instantly share code, notes, and snippets.

@seia-soto
Created June 14, 2021 09:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seia-soto/d33e31238d03c4c600ea107aede779f3 to your computer and use it in GitHub Desktop.
Save seia-soto/d33e31238d03c4c600ea107aede779f3 to your computer and use it in GitHub Desktop.
Zsh script to test if domain blocked
#!/bin/zsh
domain=
function test_dns() {
echo ""
echo "Testing on $1"
result=$(dig @$1 $domain)
if [[ -z "$(grep -i 'ANSWER SECTION:' <<< $result)" ]]
then
echo "[Blocked] Server returns no ANSWER SECTION!"
else
echo "[Not blocked] Server returned: $(grep -i -A 1 'ANSWER SECTION:' <<< $result)"
fi
echo ""
}
echo "Testing $domain"
echo "<SKT>"
test_dns 219.250.36.130
test_dns 210.220.163.82
echo "<KT>"
test_dns 168.126.63.1
test_dns 168.126.63.2
echo "<LG>"
test_dns 164.124.101.2
test_dns 203.248.252.2
echo "<CloudFlare>"
test_dns 1.1.1.1
test_dns 1.0.0.1
test_dns 1.1.1.2
test_dns 1.0.0.2
echo "<Google>"
test_dns 8.8.8.8
test_dns 8.8.4.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment