Skip to content

Instantly share code, notes, and snippets.

@angrytoast
Created April 25, 2025 23:05
Show Gist options
  • Save angrytoast/b12ec2f603bb39122d136aa67b2255c7 to your computer and use it in GitHub Desktop.
Save angrytoast/b12ec2f603bb39122d136aa67b2255c7 to your computer and use it in GitHub Desktop.
#!/bin/bash
# 1st hop CNAME lookups with Google's DNS resolver
query_results=""
for i in {1..20}; do
echo "Lookup attempt $i:"
cname_value=$(dig @8.8.8.8 THE.DOMAIN.HERE +short | head -n1)
echo "CNAME: $cname_value"
query_results+="$cname_value"$'\n'
echo "----------------------------------------"
sleep 1
done
unique_results=$(echo -n "$query_results" | sort | uniq | grep -v -e '^$')
unique_count=$(echo "$unique_results" | wc -l)
echo "Summary:"
echo "Unique CNAME values found: $unique_count"
if [ $unique_count -gt 1 ]; then
echo "Status: SUCCESS (Multiple unique CNAME values found)"
else
echo "Status: FAILURE (Only one unique CNAME value found)"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment