Funciones :
- Extrae informacion del perfil
- Scanea los tweets en busca de apps y locations
- Permite cargar las localizaciones en google maps
- Guarda todo en logs
El codigo :
Código
# !usr/bin/perl # DH Twitter Locator 0.6 # (C) Doddy Hackman 2016 # Credits : # Based in idea original of : tinfoleak by Vicente Aguilera Diaz use LWP::UserAgent; use IO::Socket::SSL; use HTTP::Request::Common; use JSON; use Data::Dumper; use MIME::Base64; use Date::Parse; use DateTime; use Getopt::Long; use Color::Output; Color::Output::Init; my $consumer_key = "IQKbtAYlXLripLGPWd0HUA"; my $consumer_secret = "GgDYlkSvaPxGxC4X8liwpUoqKwwr3lCADbz8A7ADU"; my $bearer_token = "$consumer_key:$consumer_secret"; my $bearer_token_64 = encode_base64($bearer_token); my $nave = LWP::UserAgent->new(ssl_opts => {verify_hostname => 0,SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE}); $nave->agent( "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0" ); $nave->timeout(5); GetOptions( "profile" => \$profile, "apps" => \$apps, "locations" => \$locations, "username=s" => \$username, "count=i" => \$count, "savefile=s" => \$savefile, ); head(); if ($profile) { if($profile && $username) { search_profile($username); } else { sintax(); } } if ($apps) { if($apps && $username && $count) { search_apps($username,$count); } else { sintax(); } } if ($locations) { if($locations && $username && $count) { search_locations($username,$count); } else { sintax(); } } if(!$profile and !$apps and !$locations) { sintax(); } else { if($savefile) { printear_logo("\n[+] Logs $savefile saved\n"); } } copyright(); # Functions sub search_profile { my ($username) = @_; printear_titulo("\n[+] Loading Profile in Username : "); #my $code = toma("http://localhost/twitter/getuser.php"); my $code = get_code("https://api.twitter.com/1.1/users/show.json?screen_name=".$username); my $resultado = JSON->new->decode($code); my $screen_name = $resultado->{"screen_name"}; if($screen_name eq "") { $screen_name = "Not Found"; } my $name = $resultado->{"name"}; if($name eq "") { $name = "Not Found"; } my $id = $resultado->{"id_str"}; if($id eq "") { $id = "Not Found"; } my $created = parse_date($resultado->{"created_at"}); if($created eq "") { $created = "Not Found"; } my $followers = $resultado->{"followers_count"}; if($followers eq "") { $followers = "Not Found"; } my $tweets_count = $resultado->{"statuses_count"}; if($tweets_count eq "") { $tweets_count = "Not Found"; } my $location = $resultado->{"location"}; if($location eq "") { $location = "Not Found"; } my $description = $resultado->{"description"}; if($description eq "") { $description = "Not Found"; } my $url = $resultado->{"url"}; if($url eq "") { $url = "Not Found"; } my $profile_image = $resultado->{"profile_image_url"}; if($profile_image eq "") { $profile_image = "Not Found"; } printear("Screen Name : "); printear("Username : "); printear("ID : "); printear("Created at : "); printear("Followers : "); printear("Tweets count : "); printear("Location : "); printear("Description : "); printear("URL : "); printear("Profile Image : "); printear_titulo("\n[+] Profile Loaded\n"); if($savefile) { savefile($savefile,"\n[+] Loading Profile in Username : $username\n"); savefile($savefile,"Screen Name : $screen_name"); savefile($savefile,"Username : $name"); savefile($savefile,"ID : $id"); savefile($savefile,"Created at : $created"); savefile($savefile,"Followers : $followers"); savefile($savefile,"Tweets count : $tweets_count"); savefile($savefile,"Location : $location"); savefile($savefile,"Description : $description"); savefile($savefile,"URL : $url"); savefile($savefile,"Profile Image : $profile_image"); savefile($savefile,"\n[+] Profile Loaded"); } #for my $number(1..5) { # sleep(1); # printear_logo("number : "); # printear_titulo($number."\r"); #} #printear_titulo("Number : Finished\n"); } sub search_apps { my($username,$count) = @_; printear_titulo("\n[+] Searching Apps in Username : "); #my $code = toma("http://localhost/twitter/timeline.php"); my $code = get_code("https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=".$username."&include_rts=True&count=".$count); my $resultado = JSON->new->decode($code); my @resultado = @$resultado; my $i = 0; printear_rojo("[-] Tweets not found\n"); } else { printear("[+] Tweets found : "); printear(" Tweet\t\t Date\t\t Apps\n"); if($savefile) { savefile($savefile,"\n[+] Searching Apps in Username : $username\n"); savefile($savefile," Tweet\t\t Date\t\t Apps\n"); savefile($savefile," -----------------------------------------------------\n"); } for my $result(@resultado) { $i++; my $source_split = $result->{"source"}; if($source_split=~/>(.*)<\/a>/) { my $source = $1; my $datetime = parse_date($result->{"created_at"}); if($source ne "") { if($savefile) { savefile($savefile," $i\t$datetime\t$source"); } } } } printear_titulo("\n\n[+] Apps Loaded\n"); if($savefile) { savefile($savefile,"\n[+] Apps Loaded\n"); } } } sub search_locations { my($username,$count) = @_; printear_titulo("\n[+] Searching Locations in Username : "); #my $code = toma("http://localhost/twitter/timeline.php"); my $code = get_code("https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=".$username."&include_rts=True&count=".$count); my $resultado = JSON->new->decode($code); my @resultado = @$resultado; my $i = 0; printear_rojo("[-] Tweets not found\n"); } else { printear("[+] Tweets found : "); printear(" Tweet\t\t Date\t\t Locations\n"); if($savefile) { savefile($savefile,"\n[+] Searching Locations in Username : $username\n"); savefile($savefile," Tweet\t\t Date\t\t Locations\n"); savefile($savefile," -----------------------------------------------------\n"); } for my $result(@resultado) { $i++; my $place = $result->{"place"}{"country"}; my $coordinates1 = $result->{"geo"}{"coordinates"}[0]; my $coordinates2 = $result->{"geo"}{"coordinates"}[1]; my $datetime = parse_date($result->{"created_at"}); if($place ne "") { my $data = ""; if($coordinates1 ne "" && $coordinates2 ne "") { $data = $place." [".$coordinates1.",".$coordinates2."]"; } else { $data = $place; } if($savefile) { savefile($savefile," $i\t$datetime\t$data"); } } } printear_titulo("\n\n[+] Locations Loaded\n"); if($savefile) { savefile($savefile,"\n[+] Locations Loaded\n"); } } } # More Functions sub get_token { my $code = $nave->request(POST( "https://api.twitter.com/oauth2/token", "Content-Type" => "application/x-www-form-urlencoded;charset=UTF-8", "Authorization" => "Basic $bearer_token_64", Content => { "grant_type" => "client_credentials" } ))->content; my $resultado = JSON->new->decode($code); my $token = $resultado->{"access_token"}; } sub get_code { my $code = $nave->request(GET($url,"Authorization" => "Bearer " . get_token()))->content; } sub parse_date { $time = str2time($date); my $datetime = DateTime->from_epoch(epoch => $time); } sub toma { } sub savefile { my ($filename,$text) = @_; close SAVE; } sub printear { cprint( "\x036" . $_[0] . "\x030" ); } sub printear_logo { cprint( "\x037" . $_[0] . "\x030" ); } sub printear_titulo { cprint( "\x0310" . $_[0] . "\x030" ); } sub printear_rojo { cprint( "\x034" . $_[0] . "\x030" ); } sub printear_azul { cprint( "\x033" . $_[0] . "\x030" ); } sub sintax { printear("\n[+] Sintax : "); printear("\n[+] Options : \n\n"); printear("\n[+] Example : "); print "perl dh_twitter_locator.pl -profile -apps -locations -username test -count 800 -savefile results.txt\n"; copyright(); } sub head { printear_logo("\n-- == DH Twitter Locator 0.6 == --\n\n"); } sub copyright { printear_logo("\n\n-- == (C) Doddy Hackman 2016 == --\n\n"); } #The End ?
Un video con ejemplos de uso :
Si quieren bajar el programa lo pueden hacer de aca :
SourceForge.
Github.
Eso seria todo.