Skip to main content

View Diary: Clint Curtis' "show stopper" testimony causes "gasps" at hearing (170 comments)

Comment Preferences

  •  cinch to rig (3.87)
    Here's my proof of concept. Can I get some cold hard cash from a Republican politician now? I'm thinkin', like, at least $1000 per line of code here, definitely...

    #!/usr/bin/perl
    
    # Electionfraud.pl: a simple proof-of-concept script 
    # that runs a fraudulent election.
    
    # Yeah, the code is crap.  First off, it's in Perl.
    # Second, I wrote it in 5 minutes.  But, hey!  At least I...
    use strict;
    
    # start off legit, until somebody "votes" with the fraudkey
    my $fraudkey = 'fraud';   # what to type in to enable/disable fraud
    my $fraudenabled = 0;	  # start out with no fraud
    my $fraudcandidate = 'r'; # who shall we make win?
    my $fraudextent = 0.2;	  # what fraction of other votes should we switch?
    
    my $whitehat = 0;  # make this 1 if you want to document the fraud
    
    my $endkey = 'end';  # type this to end the election
    
    # candidate letters -> candidate names
    my %candidates = ( 'd' => 'Danny Democrat',
    		   'r' => 'Richie Republican',
    		   'l' => 'Lonely Libertarian',
    		   'g' => 'Groovy Green' );
    
    # start with a clean slate
    my %candidatetally;
    foreach my $candidate (keys %candidates) {
        $candidatetally{$candidate} = 0;
    }
    
    VOTELOOP: while (1) {
    
        # print the ballot
        print "To vote for a candidate, " . 
    	  "enter the letter before the candidate's name.\n";
        foreach my $candkey (keys(%candidates)) {
    	print "\t$candkey -- $candidates{$candkey}\n";
        }
        print "Type '$endkey' to end the election and see results.\n";
    
        # get a vote
        print "vote:";
        chomp(my $vote = <STDIN>);
        print "\n";
    
        # check for end of election
        if ($vote =~ /^$endkey/) {
    	print "OKAY, ELECTION OVER.\n";
    	last VOTELOOP;
        }
    
        # check for fraud enable
        if ($vote =~ /^$fraudkey/) {
    	if ($fraudenabled) {
    	    $whitehat && print "OKAY. LEGITIMATE VOTING FROM NOW ON.\n";
    	} else {
    	    $whitehat && print "THE COMPUTER IS YOUR FRAUDULENT FRIEND.\n";
    	}
    	$fraudenabled = not $fraudenabled;
    	next VOTELOOP;
        }
        $whitehat && print "FRAUDENABLED: $fraudenabled\n";
    
        # vote
        foreach my $candidate (keys %candidates) {
    	if ($vote =~ /^$candidate/) {
    	    if ($fraudenabled && ($fraudextent > rand())) {
    		# HERE'S THE FRAUD!
    		$whitehat && print "FRAUDULENTLY RECORDING VOTE FOR " .
    					"$candidates{$fraudcandidate}!\n";
    		++$candidatetally{$fraudcandidate};
    	    } else {
    		$whitehat && print "HONESTLY VOTING FOR " .
    					"$candidates{$candidate}!\n";
    		++$candidatetally{$candidate};
    	    }
    	    print "Thank you for voting for $candidates{$candidate}.\n";
    	    print "Hit enter to clear the screen.\n";
    	    my $dummy = <STDIN>;
    	    system('clear');  # hacky, but what the hell
    	    next VOTELOOP;
    	}    
        }
        print "WTF?  I CAN'T UNDERSTAND THE VOTE '$vote' -- TRY AGAIN.\n";
    }
    
    # print the results
    print "-------------------------------------------------\n";
    print "RESULTS!\n";
    foreach my $candidate (keys %candidates) {
        print "\t$candidates{$candidate} -- $candidatetally{$candidate} votes\n";
    }
    print "-------------------------------------------------\n";
    $whitehat && print "HAVE A NICE FRAUD!\n\n";
    $whitehat || print "ANOTHER HONEST ELECTION... AS FAR AS YOU KNOW.\n\n";
    •  Better watch out, I bet you might get (4.00)
      offers; particularly, that smooth line of code, "print "WTF?  I CAN'T UNDERSTAND THE VOTE '$vote' -- TRY AGAIN.n"

      Separation of Church and State AND Corporation

      by Einsteinia on Mon Dec 13, 2004 at 09:44:38 PM PST

      [ Parent ]

    •  Why Not Just Use System Clock As Random (4.00)
      number generator?

      If last digit of seconds time = 1, record vote =R.

      • Condition only occurs 10% of the time.
      • Half the votes would have been R anyways so we're only stealing 5% of the votes. A nice modest bias.

      Takes only 3 lines of code??

      We are called to speak for the weak, for the voiceless, for victims of our nation and for those it calls enemy....--ML King, "Beyond Vietnam"

      by Gooserock on Mon Dec 13, 2004 at 10:15:54 PM PST

      [ Parent ]

      •  yep (none)
        That'd work, too. Most of the, ahem, "code" above is there to run the election itself. The fraud part is this bit:
        if ($fraudenabled && ($fraudextent > rand())) {
            ++$candidatetally{$fraudcandidate};
        }
        with the randomizer provided by the pseudorandom rand() function. (Two lines of code. Hee!) Grabbing the last second of time also works as a substitute for rand(); you could also grab the last process's PID, or many other semi-random numbers, to choose how to spread out the fraud. If somebody's looking closely enough to discover vote switching, the quality of your random number generator is not likely to hide you.

        BTW, the enabling/disabling of fraud is a fairly clumsy feature that attempts to hide the fraud from a casual test vote. The next step is to write code to replace the fraud script with a fair script once the fraud election is over; that's easily done, too, but it would take more lines of code.

        •  No, Just a clean load the instat the faked vte is (none)
          Hell you SHOULD eep the raaw vote accurate and only flip it in the transmission stream, and flipit in the raw store to0. (please not, every case that has been examined seems to find that the programming was clean loaded as soon as the final tally is transmitted.

          Clean load, and have the data store swapped to mach what was trasmitted, and ALL EVIDENCE IS IRRETRIVABLY gone.

          Wrong time, wrong war, WRONG PRESIDENT!

          by Mr Tek on Tue Dec 14, 2004 at 05:58:23 AM PST

          [ Parent ]

    •  A brilliant Thought Experiment (none)
      Brought to a scientifically-convincing conclusion. Bravo.

Subscribe or Donate to support Daily Kos.

Click here for the mobile view of the site