Tuesday, January 22, 2013

How to batch vote on PollDaddy (Mac OS X) Hack

Well I decided to try to make a way to do batch votes on PollDaddy.  It was actually pretty easy once you play around with FireBug a little bit to find the necessary fields.  Kinda sloppy, but gets the job done.

Here is the source:
Updated 1/22/13 3:14p



//
//  main.m
//  Pollhacky
//
//  Created by Donald A Wittbrodt on 1/22/13.
//  Copyright (c) 2013 Donnie Wittbrodt. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "DLoad.h"

int main(int argc, const char * argv[])
{

    @autoreleasepool {
        
        DLoad *dl = [[DLoad alloc] init];
        int numMillisecondsToDelay = 50;
        NSLog(@"Press 1 then Enter to exit.  Votes once every %d milliseconds to avoid invalid votes.", numMillisecondsToDelay);
        dl.delayTimeInMilliseconds = numMillisecondsToDelay;
        [NSThread detachNewThreadSelector:@selector(bruteVote) toTarget:dl withObject:nil];
        int i=0;
        while(1) {
            //Check to see if user cancelled
            scanf("%d", &i);
            if(i == 1) {
                //Tell the bruteVote to stop
                dl.stillVoting = NO;
                break;
            }
            //Give the main thread a small break to ease cpu usage
            usleep(0.5);
        }
        [dl release];
        
    }
    return 0;
}






//
//  DLoad.h
//  Pollhacky
//
//  Created by Donald A Wittbrodt on 1/22/13.
//  Copyright (c) 2013 Donnie Wittbrodt. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface DLoad : NSObject <NSURLConnectionDelegate>
{
    BOOL stillVoting;
    int delayTimeInMilliseconds;
    
    
}
-(void)bruteVote;
@property BOOL stillVoting;
@property int delayTimeInMilliseconds;
@end






//
//  DLoad.m
//  Pollhacky
//
//  Created by Donald A Wittbrodt on 1/22/13.
//  Copyright (c) 2013 Donnie Wittbrodt. All rights reserved.
//

#import "DLoad.h"

@implementation DLoad
@synthesize stillVoting, delayTimeInMilliseconds;

-(id)init
{
    self = [super init];
    if(self) {
        stillVoting = YES;
        delayTimeInMilliseconds = 250;
    }
    return self;
}

-(void)bruteVote
{
    while(stillVoting) {
        //Find the poll id for the poll you want
        NSString *pollID = @""; //Example: 6830128
        //Find the answer id for the answer you want
        NSString *answerID = @""; //Example: 31000396
        
        NSURL *pollURL = [NSURL URLWithString:[NSString stringWithFormat:@"http://polldaddy.com/poll/%@/", pollID]];
        
        //Get the hmtl string to get the time and token fields
        NSString *getStr = [NSString stringWithContentsOfURL:pollURL encoding:NSUTF8StringEncoding error:nil];
        //Get the time
        NSString *t = [[[[getStr componentsSeparatedByString:@",&quot;t&quot;:"] objectAtIndex:1] componentsSeparatedByString:@",&quot;"] objectAtIndex:0];
        //Get the token
        NSString *token = [[[getStr componentsSeparatedByString:@"&quot;n&quot;:&quot;"] objectAtIndex:1] substringWithRange:NSMakeRange(0, 32)];
        
        NSString *fURLString = [NSString stringWithFormat:@"http://polldaddy.com/vote.php?va=10&pt=0&r=0&p=%@&a=%@%%2C&o=&t=%@&token=%@", pollID, answerID, t, token];
        NSString *str = [NSString stringWithContentsOfURL:[NSURL URLWithString:fURLString] encoding:NSUTF8StringEncoding error:nil];
        
        //NSLog(@"%@", str);
        if([str rangeOfString:@"Thank you for voting!"].location != NSNotFound) {
            NSLog(@"Voted!! :)");
        }
        else {
            NSLog(@"Vote failed. :(");
        }
        
        //Sleep delayTimeInMilliseconds to give cpu a break
        usleep(delayTimeInMilliseconds);
    }
}
@end



13 comments:

  1. I'm trying to run this and test the script, but I keep getting "signal SIGABRT" for this line:

    NSString *t = [[[[getStr componentsSeparatedByString:@","t":"] objectAtIndex:1] componentsSeparatedByString:@",""] objectAtIndex:0];

    ReplyDelete
    Replies
    1. Hmm. I just tested it on my end and everything still works fine. In debug mode put a breakpoint on this line, and print what getStr is at this time. Paste it here so I can see what's going on.

      Delete
  2. Hmm maybe it's cause I'm doing something wrong. I have 3 files and then I ran it, but once it hits DLoad.h, it stops.

    http://i.imgur.com/5fFVNOm.jpg

    ReplyDelete
    Replies
    1. so from there it seems fine, then I put a breakpoint after this line: http://i.imgur.com/UMeWfb6.jpg

      Delete
    2. Once you hit that breakpoint, right click on getStr then click print so I can see what the result string is.

      Delete
    3. I uploaded it here:
      https://mega.co.nz/#!l90UVAJa!SAbT1hcXlfpLZD-NSJSgUTstS285zepEC7wA7EAijXU

      Delete
    4. Does that poll limit the number of votes the user can submit to 1?

      Delete
    5. Yes. I thought this would allow bypass of the limit and batch vote.

      Delete
    6. Well the poll I wrote this for allowed multiple votes (within a time limit) and this simply automated the process and sped it up. You could probably make this work with your poll by finding out what the website checks to see if a user voted, maybe an IP address or a MAC address, and spoofing these with a new value each time a vote is submitted.

      Delete
  3. This comment has been removed by the author.

    ReplyDelete
  4. Hey there!

    I'm trying to make it using php and curl, from what I read here we did it the same way, but I was just getting redirected, then I discovered it does need a cookie, so I saved the cookie together with the t and token values, and then send it when I call the vote.php, but now I get the message 'revoted', as if the vote was already counted... the poll has no limit, and I know thats something wrong because I just tested it on a new poll and it can't do a single vote.

    Did you face a similar problem? Any idea how to solve or avoid it? Is your code still working nowdays?

    Thank you!

    ReplyDelete
  5. hi there can I get code and the way to batch vote on Windows 7 ?

    ReplyDelete
  6. Best Casino Hotel Las Vegas | MapYRO
    Find the best and newest casino hotels in 고양 출장안마 Las Vegas, NV. Hotel, reviews, 삼척 출장안마 ratings, amenities: expert 속초 출장샵 Las Vegas research, 거제 출장마사지 only at Hotel and 구리 출장샵 Travel Index.

    ReplyDelete