[Perl] Scan Malware at the Virustotal Database using MD5 checksums.

Posted in Home by ApoNie

Assalamulaikum..

This perl script is command-line tools developed to scan malware with MD5 checksum at Virustotal.com database. You can choose malware file or MD5 checksum to scan it using virustotal.com database. The detection just limited to current virustotal.com database. That’s mean, if the file not yet received and scanned by virustotal before, so the program just simply give output “no Malware found”.

I’m just fixed the code because the code write by Iñaki R. (http://www.virtualminds.es) not working anymore. So, the credit is fully to Iñaki R. :)

Example of usage:

perl scanvt.pl –file “c:\a.exe”
or
perl scanvt.pl –hash 6838138fa9e49a53508c72a4b9a1a7a5

#!/usr/bin/perl

###########################################################################
##
##  Scan Malware at the Virustotal Database using MD5 checksums.
##  =====================================================================
##   Code Fixed By: ApoNie
##   Mail: shahrir1999@yahoo.com
##   Web: http://geekzlife.net
##
##   Full Credit To: Iñaki R. (http://www.virtualminds.es)
##
###########################################################################

use strict;
use LWP;
use Digest::MD5;
use Getopt::Long;

my $md5 = Digest::MD5->new;
my $virhash;
my $file;
my $hash;

GetOptions ( "file=s" => \$file,
"hash=s" => \$hash
);

if($file && $hash) {
usage();
exit 100;
}

if(!$file && !$hash) {
usage();
exit 100;
}

if(-f $file) {
open FILE,$file;
binmode(FILE);
$virhash = $md5->addfile(*FILE)->hexdigest;
print "[HASH] Using MD5 hash $virhash\n";
}
elsif ($hash) {
$virhash = $hash;
print "[HASH] Using hash $virhash\n";
}

my $ua = LWP::UserAgent->new;
push @{$ua->requests_redirectable }, 'POST';

my $resp = $ua->post('http://www.virustotal.com/vt/en/consultamd5',[ "hash" => $virhash , "x" => 138 , "y" => 24 ]);

if($resp->is_success) {
my $data = $resp->content;
my $a;
if($data =~ /Result: <span id=\"porcentaje\"><span style="color:red\;\">/) {

if ( $data =~ /color:red\;\">(.*?)\ \(/ )
{
    $a = $1;
	$a =~ s/<\/span>//;

if ( $a =~ /0\//  )
{
print "Clean "; 

}
else{ print "Malware Found "; }

}

print "($a)\n";
exit 1;
} else {
print "Malware Not Found\n";
exit 0;
}
} else {
print $resp->status_line;
exit 100;
}

sub usage () {
print "$0 (--file file | --hash hash)\n";
}

11 Comments to “[Perl] Scan Malware at the Virustotal Database using MD5 checksums.”

  • Pergh…. mmg best walaupun faham sket je, tapi nak guna tu yg x faham sgt :)

  • w00t
    ==================SNIP======================
    adnan@xps:~$ cat /usr/bin/virustotal.pl | more

    #!/usr/bin/perl

    ###########################################################################
    ##
    ## Scan Malware at the Virustotal Database using MD5 checksums.
    ## =====================================================================
    ## Code Fixed By: ApoNie
    ## Mail: shahrir1999@yahoo.com
    ## Web: http://geekzlife.net
    ##
    ## Full Credit To: Iñaki R. (http://www.virtualminds.es)
    ##
    ###########################################################################

    use strict;
    use LWP;
    use Digest::MD5;
    use Getopt::Long;

    my $md5 = Digest::MD5->new;
    my $virhash;
    my $file;
    my $hash;
    ==================SNIP======================

  • apa tujuan hang post code tu?

  • aku letak dalam /usr/bin .. maksudnye aku pakai la code hang.. tapi aku ubah sket

  • ooo.. aku noob perl, aku rasa leh optimize banyak lagi code tu.. hehehe..

    p/s: leh implement dalam MKP aku tu.. ko implementkan ahh.. :P

  • ko datang la buat… kalo free-free sket datang la

  • alah.. simple jer.. edit skit kat aku punya python tu jer, kalau ko faham ahh code yang terlebih “l337″ aku tu… wahahaha..

    aku baru jer abis exam, t ada masa aku jenguk.. ;)

  • teruskan usaha, selamat maju jaya bro. b t w, good luck

  • @fazrin2211 thanks.. good luck untuk hang gak.. ;)

  • waaaah.. abg kite dah start post dalam english.. cayalah.. when we can eat steam rice again..

  • ceh.. panggil aku adik, aku lebih muda dari hang.. perasan muda dari aku ahh tu.. :P datang sini ahh, selain hari sabtu, ada jer steam rice tu.. hehe..

Post comment

:p 8) :lol: =( :8 ;) :(( :o: :[ :) :D :-| :-[) :bloody: :cool: :choler: :love: :oups: :aie: :beurk:

Search

Download GVR 4.2 Beta

GVR Malware Definition

Twitter Updates

ShoutBox

Hosting Sponsor By

Langgan GeeKzLife.Net

Enter your email address:

Pautan