Postando mensagem no Facebook com Perl

Publicado por Perfil removido (última atualização em 11/08/2014)

[ Hits: 6.433 ]

Download fb_poster.pl




Caso ocorra algum problema, tente logar no Facebook para celular, e desative a mensagem que pede para colocar número de celular. Se mesmo assim continuar dando problema, aí já não sei o que fazer, haha.

Usando o script:

$ perl fb.pl [email] [senha]

  



Esconder código-fonte

#!/usr/bin/perl -w

# Coder: MMxM
# hc0der.blogspot.com
# Post facebook message with perl

use strict;
use LWP;
use HTTP::Cookies;
use URI::Escape;


die("\n[+] $0 <fb-email> <fb-password>\n\n") if(@ARGV!=2);
my($email,$pw) = @ARGV;
print "[*] Logging... (Wait)\n";

my $browser = LWP::UserAgent->new;
$browser->cookie_jar( {} );
$browser->agent('Mozilla/5.0 (Windows NT 6.2; rv:31.0) Gecko/20100101 Firefox/31.0');

my $body = $browser->get('https://m.facebook.com/')->content;

my %attr;
my @elements = ($body =~ /(?<=<input type="hidden" name=").*?(?<=" value=").*?(?=["])/g);
my $uri_login;

($body =~ /<form method="post" class="v w" id="login_form" novalidate="1" action="(.*?)">/)
&&($uri_login=$1) || die("Error to get login URL\n");

foreach my $hidden(@elements){
    my @tmp = split(/" value="/,$hidden);
    $attr{$tmp[0]} = uri_escape($tmp[1]);
}

$attr{'email'} = $email;
$attr{'pass'} = $pw;

my $header = $browser->post( $uri_login ,  \%attr  )->as_string;
my $location;

if($header =~ /Location: (.*)/){
    $location = $1;
} else {
    die("[-] Unexpected Error\n");
}

if($location =~ /^https:\/\/m.facebook.com\/login.php/){
    die("[-] Failed to login\n");
}

print "[+] Sucessfull Login\n";
print "[*] GETing URL to post message... (Wait)\n";

$browser->get($location);
$browser->get('https://m.facebook.com/phoneacqwrite/?s=1&source=m_mobile_mirror_interstitial');
$body = $browser->get('https://m.facebook.com/home.php?_rdr')->content;

my %attr2;
my @ele2 = ($body =~ /(?<=<input type="hidden" name=").*?(?<=" value=").*?(?=["])/g);

($body =~ /<form method="post" action="\/composer\/(.*?)">/)
&& ($location = 'https://m.facebook.com/composer/'.$1) || die("Error to get URL\n");
$location =~ s/&/&/g;

for(0..12){
    my @tmp = split (/" value="/ ,$ele2[$_]);
    next if($tmp[0] eq 'search' || $tmp[0] eq 'search_source');
    $attr2{$tmp[0]} = uri_escape($tmp[1]);
}

$attr2{'xc_message'} = '';
$attr2{'rst_icv'} = '';

$header = $browser->post($location, \%attr2)->as_string;

if($header =~ /Location: (.*)/){
    $location = $1;
} else {
    die("Error to get URL\n");
}

($location !~ /$attr2{'csid'}/) && die("Unexpected Error\n");
print "[+] OK\n";
print "[*] Acessing url ...(Wait)\n";

$body = $browser->get($location)->content;
my %attr3;
my @h = ($body =~ /(?<=<input type="hidden" name=").*?(?<=" value=").*?(?=["])/g);
if($body =~ /<form method="post" action="\/composer\/mbasic\/(.*?)" enctype="multipart\/form-data">/){
    $location='https://m.facebook.com/composer/mbasic/'.$1;
}

for(0..scalar(@h)-1){
    my @tmp = split(/" value="/,$h[$_]);
    if($_ == 6){
        $attr3{'target'} = $tmp[1];
        next;
    }
    if($_ == 12){
        $attr3{'waterfall_source'} = $tmp[1];
        next;
    }
    $attr3{$tmp[0]} = $tmp[1];
}

print "[*] Write your message:\n\n";
my $xms = <stdin>;


$attr3{'xc_message'} = $xms;
$attr3{'users_with'} = '';
$attr3{'album_id'} = '';
$attr3{'view_post'} = '';
$attr3{'file1'} = '';
$attr3{'file2'} = '';
$attr3{'file3'} = '';

my $x = $browser->post($location, Content_Type => 'multipart/form-data',
        Content => [ %attr3 ]);

if($x->as_string =~ /Location: https:\/\/m.facebook.com\/home.php/){
    print "\n[+] Message posted successfully\n";
} else {
    print "\n[-] Possible error\n";
}

#__EOF__

Scripts recomendados

Buscar Traduções no Google Translate

Synner Novo Sys(TCP) Flooder em Perl

IPloc - Informações e localização de um determinado endereço IP

Upload de múltiplos arquivos para Imageshack.us

VimeoTheSapo -Baixe videos do Vimeo e do sapo


  

Comentários

Nenhum comentário foi encontrado.


Contribuir com comentário




Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts