Created
November 4, 2010 21:45
-
-
Save unixpickle/663258 to your computer and use it in GitHub Desktop.
post a fake high score to tetris1d
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# | |
# Highscore forger for tetris1d | |
# | |
use strict; | |
use IO::Socket; | |
use Socket; | |
my $numArgs = $#ARGV + 1; | |
if ($numArgs != 2) { | |
print "Usage: testtetris.pl name score\n"; | |
exit(0); | |
} | |
my $name = $ARGV[0]; | |
my $score = $ARGV[1]; | |
my $postdata = "score=" . $score . "&savescore=" . $score . "&sid=a825751872d22bf3230a4ad530014cfc&nick=" . $name . "&comment=hacked"; | |
my $magicCookie = "a825751872d22bf3230a4ad530014cfc"; | |
# connect | |
my $nhost = 'www.tetris1d.org'; | |
my $nport = 80; | |
my $proto = getprotobyname('tcp'); | |
my $iaddr = inet_aton($nhost); | |
my $paddr = sockaddr_in($nport, $iaddr); | |
socket(SOCKET, PF_INET, SOCK_STREAM, $proto); | |
connect(SOCKET, $paddr) or die "connect: $!"; | |
print SOCKET "POST /highscore.php HTTP/1.1\n"; | |
print SOCKET "Host: www.tetris1d.org\n"; | |
print SOCKET "User-Agent: safari\n"; | |
print SOCKET "Referer: http://www.tetris1d.org/highscore.php\n"; | |
print SOCKET "Cookie: PHPSESSID=" . $magicCookie . "; __utmb=43143968;\n"; | |
print SOCKET "Content-Length: " . (length($postdata)+1) . "\n"; | |
print SOCKET "Content-Type: application/x-www-form-urlencoded\n\n"; | |
print SOCKET "$postdata\n"; | |
print "Wrote data. Waiting a few seconds for response.\n"; | |
system("sleep 4"); | |
close SOCKET or die "close: $!"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment