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

 

 


Tema destacado: Recuerda que debes registrarte en el foro para poder participar (preguntar y responder)


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


Desconectado Desconectado

Mensajes: 545



Ver Perfil
[Perl] Finder Paths 0.6
« en: 8 Abril 2012, 01:55 am »

Un simple script para buscar los famosos listados de directorios en una pagina.

Código
  1. #!usr/bin/perl
  2. #Finder Paths 0.6
  3. #Coded By Doddy H
  4.  
  5. use LWP::UserAgent;
  6. use URI::Split qw(uri_split);
  7. use HTML::LinkExtor;
  8.  
  9. my $nave = LWP::UserAgent->new();
  10. $nave->timeout(5);
  11. $nave->agent(
  12. "Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.1.12) Gecko/20080201Firefox/2.0.0.12"
  13. );
  14.  
  15. head();
  16.  
  17. print "[+] Web : ";
  18. chomp( my $web = <stdin> );
  19.  
  20. print "\n\n[+] Scan Type\n\n";
  21. print "[+] 1 : Fast\n";
  22. print "[+] 2 : Full\n";
  23.  
  24. print "\n\n[+] Option : ";
  25. chomp( my $op = <stdin> );
  26.  
  27. print "\n\n[+] Scanning ....\n\n\n";
  28.  
  29. if ( $op eq "1" ) {
  30.    simple($web);
  31. }
  32. elsif ( $op eq "2" ) {
  33.    escalar($web);
  34. }
  35. else {
  36.    simple($web);
  37. }
  38. copyright();
  39.  
  40. sub escalar {
  41.  
  42.    my $co    = $_[0];
  43.    my $code  = toma( $_[0] );
  44.    my @links = get_links($code);
  45.  
  46.    if ( $code =~ /Index of (.*)/ig ) {
  47.        print "[+] Link : $co\n";
  48.        savefile( "paths-logs.txt", $co );
  49.        my $dir_found = $1;
  50.        chomp $dir_found;
  51.        while ( $code =~ /<a href=\"(.*)\">(.*)<\/a>/ig ) {
  52.            my $ruta   = $1;
  53.            my $nombre = $2;
  54.            unless ( $nombre =~ /Parent Directory/ig
  55.                or $nombre =~ /Description/ig )
  56.            {
  57.                push( @encontrados, $_[0] . "/" . $nombre );
  58.            }
  59.        }
  60.    }
  61.  
  62.    for my $com (@links) {
  63.        my ( $scheme, $auth, $path, $query, $frag ) = uri_split( $_[0] );
  64.        if ( $path =~ /\/(.*)$/ ) {
  65.            my $path1 = $1;
  66.            $_[0] =~ s/$path1//ig;
  67.            my ( $scheme, $auth, $path, $query, $frag ) = uri_split($com);
  68.            if ( $path =~ /(.*)\// ) {
  69.                my $parche = $1;
  70.                unless ( $repetidos =~ /$parche/ ) {
  71.                    $repetidos .= " " . $parche;
  72.                    my $yeah = "http://" . $auth . $parche;
  73.                    escalar($yeah);
  74.                }
  75.            }
  76.            for (@encontrados) {
  77.                escalar($_);
  78.            }
  79.        }
  80.    }
  81. }
  82.  
  83. sub simple {
  84.  
  85.    my $code  = toma( $_[0] );
  86.    my @links = get_links($code);
  87.  
  88.    for my $com (@links) {
  89.        my ( $scheme, $auth, $path, $query, $frag ) = uri_split( $_[0] );
  90.        if ( $path =~ /\/(.*)$/ ) {
  91.            my $path1 = $1;
  92.            $_[0] =~ s/$path1//ig;
  93.            my ( $scheme, $auth, $path, $query, $frag ) = uri_split($com);
  94.            if ( $path =~ /(.*)\// ) {
  95.                my $parche = $1;
  96.                unless ( $repetidos =~ /$parche/ ) {
  97.                    $repetidos .= " " . $parche;
  98.                    my $code = toma( "http://" . $auth . $parche );
  99.  
  100.                    if ( $code =~ /Index of (.*)</ig ) {
  101.                        my $dir_found = $1;
  102.                        chomp $dir_found;
  103.                        my $yeah = "http://" . $auth . $parche;
  104.                        print "[+] Link : $yeah\n";
  105.                        savefile( "paths-logs.txt", $yeah );
  106.                    }
  107.                }
  108.            }
  109.        }
  110.    }
  111. }
  112.  
  113. sub toma {
  114.    return $nave->get( $_[0] )->content;
  115. }
  116.  
  117. sub get_links {
  118.  
  119.    $test = HTML::LinkExtor->new( \&agarrar )->parse( $_[0] );
  120.    return @links;
  121.  
  122.    sub agarrar {
  123.        my ( $a, %b ) = @_;
  124.        push( @links, values %b );
  125.    }
  126. }
  127.  
  128. sub savefile {
  129.    open( SAVE, ">>" . $_[0] );
  130.    print SAVE $_[1] . "\n";
  131.    close SAVE;
  132. }
  133.  
  134. sub head {
  135.    print qq(
  136.  
  137.  
  138. @@@@@ @           @             @@@@@           @        
  139. @                 @             @    @       @  @        
  140. @                 @             @    @       @  @        
  141. @     @ @ @@   @@@@  @@@  @@    @    @  @@@  @@ @ @@   @@
  142. @@@@  @ @@  @ @   @ @   @ @     @@@@@      @ @  @@  @ @  @
  143. @     @ @   @ @   @ @@@@@ @     @       @@@@ @  @   @  @  
  144. @     @ @   @ @   @ @     @     @      @   @ @  @   @   @
  145. @     @ @   @ @   @ @   @ @     @      @   @ @  @   @ @  @
  146. @     @ @   @  @@@@  @@@  @     @       @@@@  @ @   @  @@
  147.  
  148.  
  149.  
  150.  
  151.  
  152. );
  153. }
  154.  
  155. sub copyright {
  156.    print "\n\n(C) Doddy Hackman 2012\n\n";
  157.    <stdin>;
  158.    exit(1);
  159. }
  160.  
  161. # The End ?
  162.  


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
[Perl] Finder Paths
Scripting
BigBear 0 1,459 Último mensaje 14 Octubre 2011, 15:25 pm
por BigBear
[Perl] Finder Pass 0.3
Scripting
BigBear 0 1,486 Último mensaje 31 Marzo 2012, 22:46 pm
por BigBear
[Perl Tk] Finder Pass 0.4
Scripting
BigBear 0 1,447 Último mensaje 31 Marzo 2012, 22:47 pm
por BigBear
[Perl Tk] Finder Paths 0.7
Scripting
BigBear 0 1,416 Último mensaje 8 Abril 2012, 01:56 am
por BigBear
[Perl] Finder Text 0.2
Scripting
BigBear 0 1,350 Último mensaje 23 Junio 2012, 18:15 pm
por BigBear
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines