Skip to content

Instantly share code, notes, and snippets.

@nic0711
Forked from paslandau/redirect.sh
Last active July 25, 2017 12:25
Show Gist options
  • Save nic0711/f1ae3d13eb982cc1348db60bc0a79fc6 to your computer and use it in GitHub Desktop.
Save nic0711/f1ae3d13eb982cc1348db60bc0a79fc6 to your computer and use it in GitHub Desktop.
Bash script to check geo- and mobile redirects for aboutyou de/at/ch when using Googlebot user agents
domain="www.example"
y="at
ch
de"; \
x="
Mozilla/5.0 (iPhone; U; CPU iPhone OS 5_1_1 like Mac OS X; en) AppleWebKit/534.46.0 (KHTML, like Gecko) CriOS/19.0.1084.60 Mobile/9B206 Safari/7534.48.3
Mozilla/5.0 (iPad; U; CPU OS 5_1_1 like Mac OS X; en-us) AppleWebKit/534.46.0 (KHTML, like Gecko) CriOS/19.0.1084.60 Mobile/9B206 Safari/7534.48.3
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.67 Safari/537.36
Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.96 Mobile Safari/537.36 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)
Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0
Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)
Googlebot/2.1 (+http://www.googlebot.com/bot.html)
Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)
Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)
Mozilla/5.0 (compatible; YandexBot/3.0; +http://yandex.com/bots)
"; \
IFS="\n"; readarray -t countries <<<"$y";\
readarray -t userAgents <<<"$x"; IFS=""; \ for y in ${userAgents[@]}; do for x in ${countries[@]}; do url="https://${domain}.${x}/"; printf "\n$url with $y\n"; curl -sIL -H "user-agent: $y" $url 2>&1 | egrep 'HTTP/1.1|Location|Failed'; done; done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment