use strict; use warnings; no warnings; use LWP::UserAgent; use HTTP::Cookies; use URI::Escape::JavaScript; #--==-==-==--==-=-=-==-=-=-=-=-=--=-==-=-=====--==--=-=-=-=-=-=--=-=-=-=-=-- my $login = 'YOUR_LOGIN'; my $passw = 'YOU_PASSWORD'; my $makeErrors = 1; # скільки зробити помилок my $makecorrects = 5; # скільки зробити виправлень #--==-==-==-=-=--=-=-=-==-=-=-=-=-=--=-==-=-=====--==--=-=-=-=-=-=--=-=-=-=- print " > nabiraem.ru automatizate..\n"; print " > poma(c)2009 uasc.org.ua <3\n\n"; $| = 1; my $ua = new LWP::UserAgent; mkdir ('cookie', 777); my $cookie_jar = HTTP::Cookies->new(file => "./cookie/".rand(1).".dat", autosave => 1); $cookie_jar->clear(); $ua->cookie_jar($cookie_jar); $ua->parse_head(0); $ua->timeout(10); $ua->get('http://nabiraem.ru/')->as_string; my $page = $ua->post('http://nabiraem.ru/championship/', [ 'auth.logon' => 'do', 'auth.name' => $login, 'auth.passwd' => $passw, 'auth.persistent' => '1', 'action' => '%C2%EE%E9%F2%E8' ] )->as_string; my ($l) = $page =~ /href="(.+?)"/i; print " > trying login..\n"; $page = $ua->get($l)->as_string; $page = $ua->get('http://nabiraem.ru/')->as_string; $page = $ua->get('http://nabiraem.ru/test/test.html?level=3')->as_string; if ($page =~ /auth.logon/) { print " > unsuccess auth!\n"; ; exit(0); } print " > success auth!\n"; my ($unescape) = $page =~ /unescape\('(.+?)'\);/is; my ($id) = $page =~ /id:\s(.+?),/i; $unescape = js_unescape($unescape); print ' > get text ('.$id.'), len = '.length($unescape)."\n"; $unescape = &strreplace($unescape,'\n',"\n"); &debug($unescape);sleep(1); my $serverStartTime = 0; $page = $ua->post('http://nabiraem.ru/test/time.html?'.time().'-xml', [ 'init' => 'do', 'level' => '3', 'chars' => '0' ] )->as_string; $serverStartTime = $1 if ($page =~ /serverStartTime = (\d+);/); print ' > new serverStartTime = '.$serverStartTime."\n"; $page = $ua->post('http://nabiraem.ru/test/time.html?'.time().'-xml', [ 'init' => 'do', 'level' => '3', 'chars' => '30' ] )->as_string; $serverStartTime = $1 if ($page =~ /serverStartTime = (\d+);/); print ' > new serverStartTime = '.$serverStartTime."\n"; $page = $ua->post('http://nabiraem.ru/test/time.html?'.time().'-xml', [ 'saveTest' => 'do', 'level' => '3', 'lang' => 'ru', 'chars' => length($unescape), 'errors' => $makeErrors, 'corrects' => $makecorrects, 'id' => $id, 'started' => $serverStartTime, 'duration' => '74.031', 'url' => '/test/rating/%3Flevel%3D1%26lang%3Dru' ] )->as_string; &debug($page);sleep(1); print ' > your reiting = '.$1."\n" if ($page =~ /([\d\.]+).'/i); print " > finish! check you acc ;)\n"; ; exit(0); sub browser { my $ua = new LWP::UserAgent; my $ck = new HTTP::Cookies; $ua->cookie_jar($ck); $ua->agent(&rndUserAgent); return $ua, $ck; } sub debug { open F, ">>", "debug_".time.".html"; print F $_[0]."\r\n"; close F; } sub strreplace{ my ($string, $search, $replace) = @_; while( (my $i = index($string, $search)) > -1 ){ substr($string, $i, length($search), $replace); } return $string; } # =--=-=-=-=---=-=-=-=-----=-==-=-==-=-=-=-=-=-=-=------==-=-=-======-------=-=-=--=-=-=-=--=-==-=-=-=--==- # poma(c)2009 # ^_^ # Программа написана исключительно в образовательных целях. # И я, и автор скрипта, не несу ответственности за ее действия.