####
#  _________.__                 .__ __    ________         
# /   _____/|  |__  __ _________|__|  | __\_____  \  ____  
# \_____  \ |  |  \|  |  \_  __ \  |  |/ /  _(__  < /    \ 
# /        \|   Y  \  |  /|  | \/  |    <  /       \   |  \
#/_______  /|___|  /____/ |__|  |__|__|_ \/______  /___|  /
#        \/      \/                     \/       \/     \/ 
#
#                    Dshellnoi Unix  2013
#                      
#   CLASE      :        AUX::UTIL::Search_Exploits                                                             
#   CREADO POR   :      Hector   
#   CORREO       :      hector15501@hotmail.com                   
#   FECHA:       :      4.05.2013                           
#   ACTUALIZACION:      
#   VERSION      :      version 0.1                         
#                                                                
#   LICENCIA:                                                 
#            SUJETO A LA LICENCIA SHURIK3N            
####

package AUX::UTIL::Search_Exploits ;

use strict ;
use LIBS::GNRL::Colores ;
use Shodan::WebAPI;
use LIBS::GNRL::Texto;
my $color =  LIBS::GNRL::Colores->new();
my $texto = LIBS::GNRL::Texto->new();


use vars qw($VERSION @ISA); 
@ISA = qw(); 
$VERSION = '0.01'; 


sub new {
    my($class) = @_;
    
     my $self =  ( { Title        => "Buscador de Exploits",
                    Author        => "Hector",
                    Type          => "AUX", 
                    Date          => "4.05.2013", 
                    Ranking       => "Normal", 
                    Webauthor     => "", 
                    Description    =>qq[Search exploits],
                    
                    ARG           => [
                                       
                                        ["SEARCH", "WORD TO SEARCH", 1]
                                      ],
                  


                 });
     

    bless($self, $class);
    return $self;
}


sub run
{
  my($self,@data) = @_;
  my $so = "$data[0]";
  my $SHODAN_API_KEY = " ";

  if($SHODAN_API_KEY eq " "){
    $color->pinta("ROJO", "[-]Insert your SHODAN API KEY in the file Shurik3n/AUX/UTIL/TEST.PM \n") ;
    goto SHELL;
  }
 my $api = new Shodan::WebAPI($SHODAN_API_KEY); 
 my $results = $api->exploitdb_search($so);
 print "Results found: $results->{total}\n";
 my @matches = @{ $results->{matches} };
for (my $i = 0; $i < $#matches; $i++ ) {
        
        $color -> pinta("ROJO_CLARO", "Descripcion: $matches[$i]{description}\n"); 
        $color -> pinta("ROJO_CLARO", "Url        : http://www.exploit-db.com/exploits/$matches[$i]{id}\n"); 
        $color -> pinta("ROJO_CLARO", "Author     : $matches[$i]{author}\n"); 
        $color -> pinta("ROJO_CLARO", "Date       : $matches[$i]{date}\n");   
        $color -> pinta("ROJO_CLARO", "Type       : $matches[$i]{type}\n");  


           $color -> pinta("ROJO", "More Exploits? (N o NOT o NO for exit)");
        my $opt=<STDIN>;
                chop($opt); 

                $opt = $texto->may($opt);

                if($opt eq "N" or $opt eq "NOT" or $opt eq "NO"){                  
                  print "This module uses SHODAN available from:: \n http://www.shodanhq.com/ \n";
                  
                  goto SHELL;
                  
                  } 


}
}

1;
