msgbox

sadas

Jun 9th, 2011
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.95 KB | None | 0 0
  1. use LWP::UserAgent;
  2. use HTTP::Cookies;
  3. use warnings;
  4. use URI::Escape;
  5. use Encode qw/from_to/;
  6. use POSIX qw/strftime/;
  7.  
  8. $mail = "mail%40domain.ru";
  9. $pass = "password";
  10. $noteid = "11138832";
  11.  
  12. $browser = LWP::UserAgent->new;
  13. $cookie = HTTP::Cookies->new( file => 'cookies.cookies', autosave => 1, );
  14. $browser->cookie_jar($cookie);
  15.  
  16.  
  17.  
  18. sub str_replace {
  19.     my $replace_this = shift;
  20.     my $with_this  = shift;
  21.     my $string   = shift;
  22.     my $length = length($string);
  23.     my $target = length($replace_this);
  24.     for(my $i=0; $i<$length - $target + 1; $i++) {
  25.         if(substr($string,$i,$target) eq $replace_this) {
  26.             $string = substr($string,0,$i) . $with_this . substr($string,$i+$target);
  27.             return $string; #Comment this if you what a global replace
  28.         }
  29.     }
  30.     return $string;
  31. }
  32.  
  33. print "\n";
  34. print "Started.\n";
  35. print "[*] Auth...";
  36. $login = $browser->get("http://login.vk.com/?act=login&email=$mail&pass=$pass")->as_string;
  37. if($login =~ /reg/) {
  38. print "FAIL";
  39. #exit(1);
  40. } else {
  41. print "DONE\n";
  42. }
  43.  
  44.  
  45. $ithappens = $browser->get("http://ithappens.ru/random/")->as_string;
  46. if($ithappens =~ /p class="text">(.*)<\/p>/) {
  47. $newtext = str_replace('<br>','\n',$1);
  48. } else {
  49. print "FAIL!";
  50. exit(0);
  51. }
  52.  
  53.  
  54. $sometext = "sometext";
  55. $somecaption = "somecaption";
  56. $time = strftime('%H:%M', localtime);
  57. $text = "
  58. {|
  59. |-
  60. ! $sometext
  61. !
  62. |-
  63. | $newtext \n\n (<b>$time</b>)
  64. |
  65. |}";
  66.  
  67. print "[*] Fetching action link...";
  68. $editnote = $browser->get("http://m.vkontakte.ru/editnote$noteid")->as_string;
  69. if($editnote =~ /action="(.*)"/) {
  70. $link1 = "http://m.vkontakte.ru$1";
  71. $link = str_replace('amp;', '', $link1);
  72. $link = str_replace('amp;', '', $link);
  73. $link = str_replace('amp;', '', $link);
  74. print "OK!\n";
  75. } else {
  76. print "\nFAIL [Fetching action link]";
  77. exit(0);
  78. }
  79.  
  80. print "[*] Updating note...";
  81. $result = $browser->post($link, Content => "title=$somecaption&post=$text")->as_string;
  82. if($result =~ /\?m=3/) {
  83. print "OK!\n\n";
  84. } else {
  85. print "FAIL\n\n";
  86. }
Advertisement
Add Comment
Please, Sign In to add comment