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();
exit(1);
}
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" );
exit(1);
}
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" );
exit(1);
}
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>;
chomp $op;
cprint("\x030");
return $op;
}
}
else {
print "error\n";
}
}
sub tomar {
my ( $web, $var ) = @_;
return $nave->post( $web, [ %{$var} ] )->content;
}
#The End ?
Buena bro
Pd: no escanea el archivo, comprueba si el hash se encuentra en la bd y si se encuentra te muestra su ultimo escaneo.
Creeme es mejor asi :P
ya sabia que primero detecta el hash md5 para despues buscarlo , pero me exprese mal por escribir rapido ,cualquier otra idea con otro API decimelo asi intento hacer otro script en perl.