Tuesday, December 10, 2013

Bing Webmaster Tools - check for old verification files

Sometimes it is necessary to check if domains have the right verification files in the root folder: for an agency for a multitude of sites, for a company for several domains and subdomains.

People move on, and the webmaster or seo agency from 3 years ago is not necessarily a partner any more. And there still might be old verification files in the root folder, allowing access to data in Bing Webmaster tools (BWT)  for people who should not have access to this any more. 

And this is not just about getting access to perhaps very deep knowledge, but also about the possibility of changing settings and causing immediate monetary damage. One possible example would be a false redirect or sitelinks or target country for a site - major damage possible!

So, got to check only the right meta tags and verification files. These IDs are very long, and comparing by hand is prone to mistakes and might take quite a while. Copy paste into a spreadsheet works fine, but depending on the number of domains to check can take a while. 

Here I just show how to check for verification files. They are called BingSiteAuth.xml and mainly contain of an ID with little code around it. 
  1. Download the current file from BWT, and check this id.
  2. Next step, prepare a url list in a text file, for all domains / subdomains you want to check.
  3. Run this little authentication file checker script:
#bash
if [[ ! $1 ]] ; then
echo -e '\n\tplease call this file with a list of urls\n'
exit 1
else

while read -r line; do
url=(${line}/BingSiteAuth.xml)

site_id=$(wget -S -qO- "$url" 2> grep "" | tr "\n" "\t"  | sed -e "s/^.*//g" -e "s/<\/user.*$//g" )
# set default value for site_id, then check if gathered value matches the given value (as mentioned in intro text 
if [[ $site_id = "" ]] ; then site_id="0" ; fi
if [ ${site_id} == "78F80DA184A74A413....and-so-on...45671" ] ;
then match="match"
else match="\E[34;47m no match"
fi
# get all in one line, then reset formatting 
echo -e  ${line} "\t\tsite-id" ${site_id} ${match} `tput sgr0`

# alternate ending into file for further use BingSiteAuth-matches.txt
#if [ ${site_id} == "78F80DA184A74A4137F56098D9D45671" ] ;
# then match="match"
# else match="no match"
#fi
#echo -e  ${line} "\t\tsite-id" ${site_id} ${match} >> BingSite-check.txt 
done < $1
fi

No comments:

Post a Comment

Bookmark and Share