Created
October 24, 2011 22:50
-
-
Save sergeyromanov/1310613 to your computer and use it in GitHub Desktop.
WWW::Mechanize in action!
This file contains hidden or 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
use strict; | |
use Data::Dumper; | |
use String::Random qw(random_string); | |
use WWW::Mechanize; | |
open my $fh, '>>', 'logins.txt'; | |
my @domains = qw(mail.ru rambler.ru yandex.ru google.com yahoo.com); | |
for (0..199) { | |
my $mech = WWW::Mechanize->new(); | |
my $user = random_string('c'x11); | |
my $pass = reverse $user; | |
my $email = $user."@".$domains[int rand(scalar @domains)]; | |
print $fh $email, "\n"; | |
my $url = "http://XXX.ru/user/register"; | |
$mech->get($url); | |
sleep 10; | |
my $res = $mech->submit_form( | |
with_fields => { | |
'name' => $user, | |
'mail' => $email, | |
'pass[pass1]' => $pass, | |
'pass[pass2]' => $pass, | |
} | |
); | |
sleep 10; | |
$url = "http://XXX.ru/photos_voiting?page=7"; | |
$mech->get($url); | |
sleep 10; | |
my @inputs = $mech->form_number(1)->inputs; | |
my ($build_id, $token); | |
($build_id) = map {$_->{value}} grep {$_->{name} eq 'form_build_id'} @inputs; | |
($token) = map {$_->{value}} grep {$_->{name} eq 'form_token' } @inputs; | |
$mech->submit_form( | |
with_fields => { | |
'form_build_id' => $build_id, | |
'form_token' => $token, | |
'form_id' => 'fivestar_custom_widget', | |
'vote' => 100, | |
} | |
); | |
sleep 10; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment