Auto-Voting Script

While playing WoW on a private (free) server, my friends and I have realized that we want to earn vote points on the servers website. In order to earn these points you are supposed to log into their website and click on a couple of links that “vote” on external websites about the top 100 private WoW servers. As you get points for this you can purchase items for your characters in game. Then you can be sure to come back every 12 hours to vote again.

Coming back every 12 hours was the problem. We’d forget, or it wouldn’t be practical to get up in the middle of the night just to vote and go back to sleep. I set out to solve this problem with some collaboration from my friends.

We found a program that can interface with websites and damn near anything else through a command line driven interface. Or… if you’re really nerdy you can use their lib and write it directly into your own program. This program is hosted here: http://curl.haxx.se/ I am running cURL 7.37.0 64 bit package from their website.

vote

Here is a zip of our script along with a 32 bit version of curl. The script is in the bin folder with curl.exe.

Here we start off any bat file with @echo off, just look it up if you don’t know. Then we step into the curl directory with cd. I didn’t want to worry about typing in the full path to curl every time I needed to call it.

After this I go ahead and set some variables to the date and time. There were a couple ways for me to grab the time. I decided I liked the time /t formatting better than the %time% military style format. I remarked the other line here for you to see.

We will be using these variables for logging later in the script.

Here is our first call to cURL.
We use a -s to suppress the output to the console.
We have -k in case the ssl server can’t be verified.
We use -e “www.wow-one.com” as our referral site.
We initialize our cookie with –cookie-jar wow-one.txt.
We set our output with –output temp.htm.
And finally we tell cURL what page to run this against with the ending URL.

The temp.htm will have some important information in it. This is the webpage code that would have been sent to your browser to be interpreted into a website.

I send ver to nul because this resets the errorlevel I will need shortly to find text in temp.htm.

We have found that if you fail at the login on the website you will be presented with a captcha on your second attempt. Because I didn’t have a way to fill out the captcha with cURL and my efforts to bypass it didn’t work, I decided to add a check that will abort the login process if the captcha is present.

So at this point we should have initialized our cookie and checked the login page for captcha. If there is no captcha we will continue here. Now we go ahead and login to the website. I went through the page source and found the form input tags. I pulled the names of these and crafted a link that would get sent in a POST to the website with your login info.

In the next cURL call, you can see that we use the -d to show some data that is being passed through POST. Here you can edit this from player to your username and from secretpass to your password.

Once again we output the next page source to a htm file and check to see if we are logged in. If we aren’t logged in, we abort the voting process and log this in wow-one.log.

Because we have to wait 12 hours before we can vote we need to check to see if we are eligible to vote. I check the htm file and look for key strings. If we pass, we will move on to the voting process.

Here we use the -e tag to define our referral page again. We found we had to use the https and /vote to get this to pass on their website. Once these two pages are processed we check our vote points by reading their vote page and scraping the points into a variable.

Lastly we log our successful vote and points to our log file, and then clean up all of the htm files we’ve used during our script.

We scheduled this in the windows task scheduler on our computers and it’s running like a champ.

Leave a Reply