Título: [Perl] VirusTotal Scanner 0.1
Publicado por: BigBear en 16 Mayo 2013, 19:21 pm
Un simple script para scannear un archivo mediante el API de virustotal , la idea se me ocurrio cuando vi este script en python hecho por Sanko del foro Underc0de (http://underc0de.org/foro/python/file-and-process-vt-checker/). Una imagen : (http://doddyhackman.webcindario.com/images/scanvir.jpg) #!usr/bin/perl #VirusTotal Scanner 0.1 #Coded By Doddy H #ppm install http://www.bribes.org/perl/ppm/JSON.ppd #ppm install http://trouchelle.com/ppm/Digest-MD5-File.ppd #ppm install http://www.bribes.org/perl/ppm/Crypt-SSLeay.ppd #ppm install http://trouchelle.com/ppm/Color-Output.ppd use JSON; use Digest ::MD5::File qw(file_md5_hex ); use LWP::UserAgent; use Color::Output; Color::Output::Init; my $nave = LWP::UserAgent->new; $nave->agent( "Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.1.12) Gecko/20080201Firefox/2.0.0.12" ); $nave->timeout(5); my $api_key = "yourapi" ; #Your API Key head(); unless ( $ARGV[0] ) { printear( "[+] Sintax : $0 <file to scan>", "text", "11", "5" ); copyright(); } else { unless ( -f $ARGV[0] ) { printear( "\n[-] File Not Found\n", "text", "5", "5" ); copyright(); } my $md5 = file_md5_hex( $ARGV[0] ); printear( "\n[+] Checking ...\n", "text", "7", "5" ); my $code = tomar( "https://www.virustotal.com/vtapi/v2/file/report", { "resource" => $md5, "apikey" => $api_key } ); if ( $code =~ /"response_code": 0/ ) { printear( "\n[+] Not Found\n", "text", "7", "5" ); } my $dividir = decode_json $code; printear( "[+] Getting data ...\n", "text", "7", "5" ); printear( "[+] Scan ID : " . $dividir->{scan_id}, "text", "13", "5" ); printear( "[+] Scan Date : " . $dividir->{scan_date}, "text", "13", "5" ); printear( "[+] Permalink : " . $dividir->{permalink}, "text", "13", "5" ); printear( "[+] Virus Founds : " . $dividir->{positives} . "/" . $dividir->{total}, "text", "13", "5" ); printear( "\n[+] Getting list ...\n", "text", "7", "5" ); my %abrir = %{ $dividir->{scans} }; for my $antivirus ( keys %abrir ) { if ( $abrir{$antivirus}{"result"} eq "" ) { printear( "[+] " . $antivirus . " : Clean", "text", "11", "5" ); } else { printear( "[+] " . $antivirus . " : " . $abrir{$antivirus}{"result"}, "text", "5", "5" ); } } printear( "\n[+] Finished\n", "text", "7", "5" ); copyright(); } sub head { printear( "\n-- == VirusTotal Scanner 0.1 == --\n", "text", "13", "5" ); } sub copyright { printear( "\n[+] Written By Doddy H", "text", "13", "5" ); } sub printear { if ( $_[1] eq "text" ) { cprint( "\x03" . $_[2] . $_[0] . "\x030\n" ); } elsif ( $_[1] eq "stdin" ) { if ( $_[3] ne "" ) { cprint( "\x03" . $_[2] . $_[0] . "\x030" . "\x03" . $_[3] ); my $op = <stdin>; cprint("\x030"); } } else { } } sub tomar { my ( $web, $var ) = @_; return $nave->post( $web, [ %{$var} ] )->content; } #The End ?
Título: Re: [Perl] VirusTotal Scanner 0.1
Publicado por: Danyfirex en 16 Mayo 2013, 21:49 pm
Gracias muy bueno el código. ;-)
PD: no escanea un archivo. Retorna el reporte de un archivo ya escaneado.
saludos
Título: Re: [Perl] VirusTotal Scanner 0.1
Publicado por: BigBear en 16 Mayo 2013, 22:23 pm
Gracias muy bueno el código. ;-)
PD: no escanea un archivo. Retorna el reporte de un archivo ya escaneado.
saludos
si , me exprese mal.
Título: Re: [Perl] VirusTotal Scanner 0.1
Publicado por: Shell Root en 17 Mayo 2013, 06:44 am
La verdad no entiendo para que traduces algo de un lenguaje a otro...
Título: Re: [Perl] VirusTotal Scanner 0.1
Publicado por: BigBear en 17 Mayo 2013, 18:43 pm
La verdad no entiendo para que traduces algo de un lenguaje a otro...
si , es porque siempre me gusta programar en los lenguajes que conozco que son Perl,Python,Ruby,PHP,Delphi,C,Java y proximamente C#.
|