Skip to content

Instantly share code, notes, and snippets.

@alikalantaripor
Last active December 20, 2020 09:40
Show Gist options
  • Save alikalantaripor/384bef807f48dde13e981dc2ec78a1f9 to your computer and use it in GitHub Desktop.
Save alikalantaripor/384bef807f48dde13e981dc2ec78a1f9 to your computer and use it in GitHub Desktop.
Performs reverse and forward DNS lookups to list Googlebot's IPs, given a list of IP addresses as a file. Useful for filtering access logs to find out actual Googlebot visits. An implementation of https://support.google.com/webmasters/answer/80553?hl=en
#!/bin/bash
# example: ./find-google-ips.sh list.txt > google.txt
while IFS= read -r ip
do
FIND_HOST="$(host $ip)"
if [[ $FIND_HOST == *"google"* ]]; then
echo $ip
fi
done < "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment