msgbox

sprashivai.ru

Oct 19th, 2011
522
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 2.15 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. use LWP::UserAgent;
  4. use HTTP::Cookies;
  5. use URI::Escape;
  6. use Digest::MD5 qw(md5_hex);
  7.  
  8. $users_count = '6'; # лимит юзеров, у скольки спросим
  9. $email = 'myemail'; # мыло
  10. $pass = md5_hex 'mypassword'; # пасс
  11. $question = 'день удался?:)'; # вопрос
  12.  
  13.   $q = uri_escape($question);
  14.   $browser = LWP::UserAgent->new;
  15.   $cookie = HTTP::Cookies->new;
  16.   $browser->cookie_jar($cookie);
  17.  
  18.     print "Auth on site...";
  19.     $data = $browser->post("http://sprashivai.ru/login", ['email' => $email, 'pass' => $pass])->as_string;
  20.       if ($data =~ /username\":\"(.*?)\"/) { print "as $1"; } else { print "there is an error!\n"; exit(); }
  21.  
  22.       print "\nParse users...";
  23.       while($i!=$users_count) {
  24.       $request ++;
  25.       $data = $browser->get("http://sprashivai.ru/live")->as_string;
  26.           while ($data =~ /<a href=\"\/(.*?)\" style=\"border: 0;\">/go) {
  27.           if (grep(/^$1$/, @users)) { }
  28.           else { push(@users, "$1"); $i ++; }
  29.           if ($i >= $users_count) { next; }
  30.           }
  31.           pop(@users);
  32.           while ($data =~ /\"username\":\"(.*?)\"/go) {
  33.           if ($i >= $users_count) { next; }
  34.           if (grep(/^$1$/, @users)) { }
  35.           else { push(@users, "$1"); $i ++; }
  36.           }
  37.       if ($i == $users_count) { break; }
  38.       }
  39.  
  40.     $status = '';
  41.     $answer = '';
  42.     foreach (@users) {
  43.     print "$status!\nSend question to $_...";
  44.     $data = $browser->post("http://sprashivai.ru/questions/ask", ['username' => $_, 'question' => $q, 'anonimous' => 'true'])->as_string;
  45.     $status = $1 if ($data =~ /status\":\"(.*?)\"/go);
  46.     }
  47.  
  48.     while($answer!='') {
  49.       foreach (@users) {
  50.       print "Looking for a response from $_...";
  51.       $data = $browser->get("http://sprashivai.ru/$_")->as_string;
  52.         if ($data =~ /<div class=\"text-question\">$question<\/div>/) {
  53.         if ($data =~ /<div class=\"text-answer\">(.*?)<\/div>/) { $answer = $1; };
  54.         print "Yeah, $_ answered the question: $answer\n";
  55.         } else {
  56.         print "$_ has not yet responded...\n";
  57.         }
  58.       }
  59.     }
  60.  
  61.     print "Finished!\n";
  62.     exit();
  63.  
Advertisement
Add Comment
Please, Sign In to add comment