Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl -w
- use LWP::UserAgent;
- use HTTP::Cookies;
- use URI::Escape;
- use Encode qw/from_to/;
- use POSIX qw/strftime/;
- use JSON;
- $mail = '';
- $pass = '';
- $noteid = '';
- $browser = LWP::UserAgent->new;
- $cookie = HTTP::Cookies->new( file => 'cookies.cookies', autosave => 1, );
- $browser->cookie_jar($cookie);
- sub str_replace {
- my $replace_this = shift;
- my $with_this = shift;
- my $string = shift;
- my $length = length($string);
- my $target = length($replace_this);
- for(my $i=0; $i<$length - $target + 1; $i++) {
- if(substr($string,$i,$target) eq $replace_this) {
- $string = substr($string,0,$i) . $with_this . substr($string,$i+$target);
- return $string;
- }
- }
- return $string;
- }
- print "\nStarted\n";
- $login = $browser->get("http://login.vk.com/?act=login&email=$mail&pass=$pass")->as_string;
- if($login =~ /reg/){
- print "Auth fail\n";
- exit(1);
- } else {
- print "[*] Auth done\n";
- }
- print "[*] Parsing inbox...\n";
- $inbox = $browser->get("http://vkontakte.ru/mail?section=inbox")->as_string;
- if($inbox =~ /mail_summary">(.*) ([0-9]+) (.*)<\/span>/){
- $inbox = $2;
- } else {
- print "[fail]\n";
- exit(1);
- }
- print "[*] Parsing outbox...\n";
- $outbox = $browser->get("http://vkontakte.ru/mail?section=outbox")->as_string;
- if($outbox =~ /mail_summary">(.*) ([0-9]+) (.*)<\/span>/){
- $outbox = $2;
- } else {
- print "[fail]";
- exit(1);
- }
- $intin = int($inbox);
- $intout = int($outbox);
- $total = $intin + $intout;
- print "[*] Parsing feed2...\n";
- $feed2 = $browser->get("http://vkontakte.ru/feed2.php")->content;
- $json = JSON->new->allow_nonref;
- $perl_scalar = $json->decode( $feed2 );
- if (defined($perl_scalar->{friends}->{count})){
- $friends = $perl_scalar->{friends}->{count};
- }else{
- $friends = "some error";
- }
- if (defined($perl_scalar->{messages}->{count})){
- $new_msg = $perl_scalar->{messages}->{count};
- }else{
- $new_msg = "some error";
- }
- if (defined($perl_scalar->{gifts}->{count})){
- $gifts = $perl_scalar->{gifts}->{count};
- }else{
- $gifts = "some error";
- }
- if (defined($perl_scalar->{events}->{count})){
- $events = $perl_scalar->{events}->{count};
- }else{
- $events = "some error";
- }
- if (defined($perl_scalar->{groups}->{count})){
- $groups = $perl_scalar->{groups}->{count};
- }else{
- $groups = "some error";
- }
- print "[*] Parsing payments...\n";
- $votes = $browser->get("http://vkontakte.ru/payments.php")->as_string;
- if($votes =~ /window.userBalance = '(.*)';/){
- $votes = $1;
- $money = $browser->get("http://vkontakte.ru/payments.php")->as_string;
- if($money =~ /window.userMoney = '(.*)';/) {
- $money = $1;
- }
- }
- $all_friends = $browser->get("http://vkontakte.ru/friends?section=all")->as_string;
- if($all_friends =~ /friends_summary">(.*) ([0-9]+) (.*)<\/div>/){
- $all_friends = $2;
- }
- $time = strftime('%H:%M', localtime);
- $title = "Умная заметка на Perl ($time)";
- $text = "
- {|
- |-
- ! Zametka (v.1.0)
- !
- |-
- | Всего друзей
- | $all_friends
- |-
- | Заявок в друзья
- | $friends
- |-
- | Личных сообщений
- | $total
- |-
- | Входящих
- | $inbox
- |-
- | Исходящих
- | $outbox
- |-
- | Новых сообщений
- | $new_msg
- |-
- | Новых подарков
- | $gifts
- |-
- | Приглашений на встречи
- | $events
- |-
- | Приглашений в группы
- | $groups
- |-
- | Количество голосов
- | $votes
- |-
- | Количество рублей
- | $money
- |-
- | Время последнего обновления скрипта
- | <b>$time</b>
- |}";
- print "[*] Fetching action link...";
- $editnote = $browser->get("http://m.vkontakte.ru/editnote$noteid")->as_string;
- if($editnote =~ /action="(.*)"/) {
- $link1 = "http://m.vkontakte.ru$1";
- $link = str_replace('amp;', '', $link1);
- $link = str_replace('amp;', '', $link);
- $link = str_replace('amp;', '', $link);
- print "[ok]\n";
- } else {
- print "[fail]";
- exit(0);
- }
- print "[*] Updating note...";
- $result = $browser->post($link, Content => "title=$title&post=$text")->as_string;
- if($result =~ /\?m=3/) {
- print "[ok]\n\n";
- } else {
- print "[fail]\n";
- }
- print "
- All friends : $all_friends
- New friends : $friends
- Total messages : $total
- Messages in inbox : $inbox
- Messages in outbox : $outbox
- New messages : $new_msg
- New gifts : $gifts
- New invite events : $events
- Vote : $votes
- Money : $money
- New invite groups : $groups\n\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement