elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Únete al Grupo Steam elhacker.NET


+  Foro de elhacker.net
|-+  Programación
| |-+  Scripting
| | |-+  [Perl] VirusTotal Scanner 0.1
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: [Perl] VirusTotal Scanner 0.1  (Leído 3,003 veces)
BigBear


Desconectado Desconectado

Mensajes: 545



Ver Perfil
[Perl] VirusTotal Scanner 0.1
« 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.

Una imagen :



Código
  1. #!usr/bin/perl
  2. #VirusTotal Scanner 0.1
  3. #Coded By Doddy H
  4. #ppm install http://www.bribes.org/perl/ppm/JSON.ppd
  5. #ppm install http://trouchelle.com/ppm/Digest-MD5-File.ppd
  6. #ppm install http://www.bribes.org/perl/ppm/Crypt-SSLeay.ppd
  7. #ppm install http://trouchelle.com/ppm/Color-Output.ppd
  8.  
  9. use JSON;
  10. use Digest::MD5::File qw(file_md5_hex);
  11. use LWP::UserAgent;
  12. use Color::Output;
  13. Color::Output::Init;
  14.  
  15. my $nave = LWP::UserAgent->new;
  16. $nave->agent(
  17. "Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.1.12) Gecko/20080201Firefox/2.0.0.12"
  18. );
  19. $nave->timeout(5);
  20.  
  21. my $api_key = "yourapi"
  22.  ;    #Your API Key
  23.  
  24. head();
  25.  
  26. unless ( $ARGV[0] ) {
  27.    printear( "[+] Sintax : $0 <file to scan>", "text", "11", "5" );
  28.  
  29.    copyright();
  30.    exit(1);
  31. }
  32. else {
  33.  
  34.    unless ( -f $ARGV[0] ) {
  35.        printear( "\n[-] File Not Found\n", "text", "5", "5" );
  36.        copyright();
  37.    }
  38.  
  39.    my $md5 = file_md5_hex( $ARGV[0] );
  40.  
  41.    printear( "\n[+] Checking ...\n", "text", "7", "5" );
  42.  
  43.    my $code = tomar(
  44.        "https://www.virustotal.com/vtapi/v2/file/report",
  45.        { "resource" => $md5, "apikey" => $api_key }
  46.    );
  47.  
  48.    if ( $code =~ /"response_code": 0/ ) {
  49.        printear( "\n[+] Not Found\n", "text", "7", "5" );
  50.        exit(1);
  51.    }
  52.  
  53.    my $dividir = decode_json $code;
  54.  
  55.    printear( "[+] Getting data ...\n", "text", "7", "5" );
  56.  
  57.    printear( "[+] Scan ID : " . $dividir->{scan_id},     "text", "13", "5" );
  58.    printear( "[+] Scan Date : " . $dividir->{scan_date}, "text", "13", "5" );
  59.    printear( "[+] Permalink : " . $dividir->{permalink}, "text", "13", "5" );
  60.    printear(
  61.        "[+] Virus Founds : " . $dividir->{positives} . "/" . $dividir->{total},
  62.        "text", "13", "5"
  63.    );
  64.  
  65.    printear( "\n[+] Getting list ...\n", "text", "7", "5" );
  66.  
  67.    my %abrir = %{ $dividir->{scans} };
  68.  
  69.    for my $antivirus ( keys %abrir ) {
  70.  
  71.        if ( $abrir{$antivirus}{"result"} eq "" ) {
  72.            printear( "[+] " . $antivirus . " : Clean", "text", "11", "5" );
  73.        }
  74.        else {
  75.            printear(
  76.                "[+] " . $antivirus . " : " . $abrir{$antivirus}{"result"},
  77.                "text", "5", "5" );
  78.        }
  79.    }
  80.  
  81.    printear( "\n[+] Finished\n", "text", "7", "5" );
  82.    copyright();
  83.  
  84. }
  85.  
  86. sub head {
  87.    printear( "\n-- == VirusTotal Scanner 0.1 == --\n", "text", "13", "5" );
  88. }
  89.  
  90. sub copyright {
  91.    printear( "\n[+] Written By Doddy H", "text", "13", "5" );
  92.    exit(1);
  93. }
  94.  
  95. sub printear {
  96.    if ( $_[1] eq "text" ) {
  97.        cprint( "\x03" . $_[2] . $_[0] . "\x030\n" );
  98.    }
  99.    elsif ( $_[1] eq "stdin" ) {
  100.        if ( $_[3] ne "" ) {
  101.            cprint( "\x03" . $_[2] . $_[0] . "\x030" . "\x03" . $_[3] );
  102.            my $op = <stdin>;
  103.            chomp $op;
  104.            cprint("\x030");
  105.            return $op;
  106.        }
  107.    }
  108.    else {
  109.        print "error\n";
  110.    }
  111. }
  112.  
  113. sub tomar {
  114.    my ( $web, $var ) = @_;
  115.    return $nave->post( $web, [ %{$var} ] )->content;
  116. }
  117.  
  118. #The End ?
  119.  


« Última modificación: 18 Mayo 2013, 03:36 am por Doddy » En línea

Danyfirex


Desconectado Desconectado

Mensajes: 493


My Dear Mizuho


Ver Perfil
Re: [Perl] VirusTotal Scanner 0.1
« Respuesta #1 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


En línea

BigBear


Desconectado Desconectado

Mensajes: 545



Ver Perfil
Re: [Perl] VirusTotal Scanner 0.1
« Respuesta #2 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.
En línea

Shell Root
Moderador Global
***
Desconectado Desconectado

Mensajes: 3.723


<3


Ver Perfil WWW
Re: [Perl] VirusTotal Scanner 0.1
« Respuesta #3 en: 17 Mayo 2013, 06:44 am »

La verdad no entiendo para que traduces algo de un lenguaje a otro...
En línea

Por eso no duermo, por si tras mi ventana hay un cuervo. Cuelgo de hilos sueltos sabiendo que hay veneno en el aire.
BigBear


Desconectado Desconectado

Mensajes: 545



Ver Perfil
Re: [Perl] VirusTotal Scanner 0.1
« Respuesta #4 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#.
En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
no puedo entrar a virustotal.com
Redes
javirojas 1 3,360 Último mensaje 2 Mayo 2010, 18:50 pm
por Banker25
WTF!? Es posible!?(Virustotal) « 1 2 »
Seguridad
CAR3S? 15 9,719 Último mensaje 23 Octubre 2011, 18:36 pm
por 2Fac3R
[AutoIt] VirusTotal API 2.0 UDF
Scripting
Danyfirex 0 3,661 Último mensaje 4 Junio 2013, 13:40 pm
por Danyfirex
[Delphi] VirusTotal Scanner 0.1
Programación General
BigBear 0 2,033 Último mensaje 1 Noviembre 2013, 16:51 pm
por BigBear
[C#] VirusTotal Scanner 0.1
.NET (C#, VB.NET, ASP)
BigBear 4 2,932 Último mensaje 28 Junio 2014, 03:54 am
por BigBear
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines