Hero Inc.

where heroes are an everyday occurrence

Aug-14-2010

Who’s Your PollDaddy…

…or at least I think how I was able to vote multiple times for a Polldaddy, erm, poll.

Quick backstory, a friend of mine was recently in a contest that required a community to vote on the best. Most votes wins the contest. Therefore, of course we wanted to vote as many times as possible but the contest was using Polldaddy which allowed only a single vote per day. That’s no fun and I assumed there had to be some other way.

My first step was to see how votes were being blocked. I cleared the cache and cookies.  Well that didn’t work as that would have been just too easy for anyone to do.  Therefore, I began to assume it was IP based as that’s probably the best way to ensure a single vote for users, but it also prevents say a house of roommates for voting.  It’s a single vote per household and not the more accurate single vote per person per day.

I setup to research the tools that I would need and came up with the following:

  • polipo – Polipo is a small web proxy to funnel my requests through.  This was my first time using it.
  • iMacro for Firefox – This is an easy tool for scripting tasks within a browser.  I’ve used in the past to vote daily in contests where I’m too lazy to navigate to the site myself.
  • Firefox – If I’m using iMacro for Firefox, then I have to use Firefox.
  • Torbutton for Firefox – This is another Firefox extension that I had not used before.  It allows a browser to use Tor for online anonymity.
  • wmctrl – This is a command line tool for interacting with X Window Manager.  You’ll see how this is used in my bash script below.
  • Bash – I am using linux and not the best programmer so I just used what was available to me.  Please no jokes about my terrible scripts.  Everyone’s learning here.

Now that I have the tools, I need to write two scripts.  The first script is the iMacro which is really easy to do.  The second script is the one to integrate the various components.

Upon installing iMacro, open the command window for it within Firefox.  It should open by default after installation.  You will find a record button.  Once pressed, anything you do in the browser will be recorded for playback or “automated browsing.”  Here’s my script for polldaddy:

VERSION BUILD=6700624 RECORDER=FX
TAB T=1
URL GOTO=http://polldaddy.com/poll/[INSERT POLL ID NUMBER HERE]
TAG POS=1 TYPE=INPUT:RADIO FORM=NAME:formPoll ATTR=ID:[SELECTED VALUE FOR POLL]
TAG POS=1 TYPE=INPUT:BUTTON ATTR=VALUE:Vote!

Now that the simple script is out of the way, its on to the more “difficult” one because my real scripting skills are beginner at best. But armed with the internet, one can do almost anything.  I needed the bash script to do the following:

  1. Start Polipo
  2. Start Firefox
  3. Initiate the iMacro script I wrote above
  4. Close Firefox correctly instead of just killing the process
  5. Kill the Polipo task

Well, here’s what I did with comments to state what each line is doing:

#!/bin/bash

echo "#####################################";
echo "###     VoteOnPolldaddy Script   ###";
echo "##   created by Benjamin Trice   ###";
echo "###         July 06, 2010        ###";
echo "####################################";
echo;
echo;
echo;

echo "START SCRIPT";
#echo "Clear cahce for polipo";
#gnome-terminal -e "polipo -x";
#echo "Sleep for 2 seconds";
#sleep 2;
echo "Start Polipo";
gnome-terminal -e polipo;
echo "Sleep for 10 seconds";
sleep 10;
echo "Start Firefox";
gnome-terminal -e "firefox http://www.google.com";
echo "Sleep for 5 seconds"
sleep 5;
echo "Start Firefox with iMacro"
gnome-terminal -e "firefox http://run.imacros.net/?m=[INSERT IMACRO NAME].iim";
echo "Sleep for 75 seconds"
sleep 75;
echo "Close Firefox correctly"
wmctrl -c firefox;
sleep 5;
wmctrl -c firefox;
sleep 5;
pkill -f polipo;
echo "END SCRIPT";

Here’s a few extra notes about setup.

  • Not sure if it helps or not, but go into Firefox and set the preferences to clear the cookies and cache when Firefox is closed.  This option is why I had to use wmctrl to properly shutdown Firefox.  Killing the process, in my limited testing, seemed to not clear the cache and cookies properly.
  • Setting up Polipo with Tor and Firefox is simple.  The Tor Project even has a great guide for that.
  • Setup a cronjob or other automated task launcher to run the bash script every 10 minutes or so.  I ended up using kalarm (yes, in Ubuntu) as my cronjob didn’t seem to run and I was getting aggravated at this point and went the lazy GUI route.  I did have some issues with the script not starting properly, but I attributed that to kAlarm and not the script itself.

Now before any potential readers who care about this subject start attacking me, I know this solution isn’t perfect nor does it vote an infinite number of times.  It seemed to be limited by the IP addresses that Tor masked me as and as Polldaddy learns what anonymous IPs exist they will begin to block them.  My original goal was to figure out how to vote an infinite number of times in a day.  That goal failed but I was able to at least get the 5+ votes in a day that Polldaddy was blocking for myself and roommates.

Anyone have a better solution?

Posted under Internet, Linux | Tagged as , ,