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

 

 


Tema destacado: Guía actualizada para evitar que un ransomware ataque tu empresa


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


Desconectado Desconectado

Mensajes: 545



Ver Perfil
[Perl] FinderPaths 0.5
« en: 1 Diciembre 2011, 22:10 pm »

Simple programa para buscar el tipico listado de directorios , lo pueden usar de dos formas , la primera es una busqueda simple y la otra al estilo spider , esta ultima nos ayuda a seguir buscando directorios escalando los encontrados

Código
  1. #!usr/bin/perl
  2. #Finder Paths 0.5 Coded By Doddy H
  3.  
  4. use LWP::UserAgent;
  5. use URI::Split qw(uri_split);
  6. use HTML::LinkExtor;
  7. use Getopt::Long;
  8.  
  9. my $nave = LWP::UserAgent->new();
  10. $nave->timeout(5);
  11. $nave->agent("Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.1.12) Gecko/20080201Firefox/2.0.0.12");
  12.  
  13. GetOptions(
  14. "-target=s" => \$target,
  15. "-option=s" => \$opcion);
  16.  
  17. head();
  18. unless ($target && $opcion) {
  19. sintax();
  20. }
  21. else  {
  22. if ($opcion eq "spider") {
  23. print "\n[+] Searching in $target\n";
  24. escalar($target);
  25. }
  26. elsif($opcion eq "simple") {
  27. print "\n[+] Searching in $target\n\n\n";
  28. simple($target);
  29. } else {
  30. print "\n[-] Error\n";
  31. }
  32. }
  33. copyright();
  34.  
  35. sub escalar {
  36.  
  37. my $code  = toma( $_[0] );
  38. my @links = get_links($code);
  39.  
  40. if ( $code =~ /Index of (.*)</ig ) {
  41. my $dir_found = $1;
  42. chomp $dir_found;
  43. print "\n\n[+] Directory Found : $dir_found\n\n";
  44. while ( $code =~ /<a href=\"(.*)\">(.*)<\/a>/ig ) {
  45. my $ruta   = $1;
  46. my $nombre = $2;
  47. unless ( $nombre =~ /Parent Directory/ig or $nombre =~ /Description/ig ) {
  48. unless ($nombre=~/\/$/) {
  49. print "[+] File Found : $nombre\n";
  50. }
  51. push(@encontrados,$_[0]."/".$nombre);
  52. }
  53. }
  54. }
  55.  
  56. #get more
  57.  
  58. for my $com (@links) {
  59. my ( $scheme, $auth, $path, $query, $frag ) = uri_split( $_[0] );
  60. if ( $path =~ /\/(.*)$/ ) {
  61. my $path1 = $1;
  62. $_[0] =~ s/$path1//ig;
  63. my ( $scheme, $auth, $path, $query, $frag ) = uri_split($com);
  64. if ( $path =~ /(.*)\// ) {
  65. my $parche = $1;                                
  66. unless($repetidos=~/$parche/){
  67. $repetidos.=" ".$parche;
  68. escalar("http://".$auth.$parche );                    
  69. }
  70. }
  71. for(@encontrados) {
  72. escalar($_);
  73. }}}}
  74.  
  75. sub simple {
  76.  
  77. my $code  = toma($_[0]);
  78. my @links = get_links($code);
  79.  
  80. for my $com (@links) {
  81. my ( $scheme, $auth, $path, $query, $frag ) = uri_split( $_[0] );
  82. if ( $path =~ /\/(.*)$/ ) {
  83. my $path1 = $1;
  84. $_[0] =~ s/$path1//ig;
  85. my ( $scheme, $auth, $path, $query, $frag ) = uri_split($com);
  86. if ( $path =~ /(.*)\// ) {
  87. my $parche = $1;                                
  88. unless($repetidos=~/$parche/){
  89. $repetidos.=" ".$parche;
  90. my $code=toma("http://".$auth.$parche);    
  91.  
  92. if ( $code =~ /Index of (.*)</ig ) {
  93. my $dir_found = $1;
  94. chomp $dir_found;
  95. print "[+] Directory Found : $dir_found\n";
  96. }}}}}}
  97.  
  98. sub toma {
  99. return $nave->get( $_[0] )->content;
  100. }
  101.  
  102. sub get_links {
  103.  
  104. $test = HTML::LinkExtor->new( \&agarrar )->parse( $_[0] );
  105. return @links;
  106.  
  107. sub agarrar {
  108. my ( $a, %b ) = @_;
  109. push( @links, values %b );
  110. }
  111. }
  112.  
  113. sub head {
  114. print "\n\n-- == FinderPaths 0.5 == --\n\n";
  115. }
  116.  
  117. sub sintax {
  118. print "\n[+] Sintax : $0 -target <web> -option <simple/spider>\n";
  119. }
  120.  
  121. sub copyright {
  122. print "\n\n(C) Doddy Hackman 2011\n\n";
  123. }
  124.  
  125. # The End ?
  126.  


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
perl
Scripting
nobo 0 3,203 Último mensaje 22 Febrero 2005, 07:49 am
por nobo
Perl
Scripting
zhynar_X 2 2,231 Último mensaje 12 Enero 2008, 04:36 am
por GroK
-=PERL=-
Scripting
D4RIO 1 5,723 Último mensaje 25 Febrero 2008, 17:27 pm
por D4RIO
MSN Perl y PHP
Scripting
isseu 0 2,677 Último mensaje 30 Diciembre 2008, 14:36 pm
por isseu
Libros de Perl online [PERL]
Scripting
madpitbull_99 0 3,839 Último mensaje 18 Mayo 2011, 21:49 pm
por madpitbull_99
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines