Advertisement
Guest User

Apache-Home Finder

a guest
Jun 16th, 2011
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.29 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. use HTTP::Request;
  4.  
  5. use LWP::UserAgent;
  6.  
  7.  
  8.  
  9. if(!$ARGV[3])
  10.  
  11.     {
  12.  
  13.         print "\n\n##################################";
  14.  
  15.         print "\n# Apache-Home Finder by localh0t #";
  16.  
  17.         print "\n##################################";
  18.  
  19.         print "\n\nUso: perl $0 [WEBSITE] [USERS LIST] [DIRECTORY LIST] [PATH TO SAVE (HTML)]";
  20.  
  21.         print "\nEx : perl $0 http://www.website.com users.txt dirs.txt results.html\n\n";
  22.  
  23.         exit(0);
  24.  
  25.     }
  26.  
  27.  
  28.  
  29. $ua = LWP::UserAgent->new;
  30.  
  31. $ua->agent("Google Bot");
  32.  
  33.  
  34.  
  35. ($web, $users, $dirs, $save) = @ARGV;
  36.  
  37.  
  38.  
  39. if ( $web   !~   /^http:/ )
  40.  
  41.   {
  42.  
  43.       $web = "http://" . $web;
  44.  
  45.   }
  46.  
  47.  
  48.  
  49. open USERS, $users;
  50.  
  51. open SAVE, ">>$save";
  52.  
  53.  
  54.  
  55. print "\n[!] Scanning $web for files in users, saving in $save\n\n";
  56.  
  57.  
  58.  
  59. foreach $lista(<USERS>)
  60.  
  61. {
  62.  
  63.     chomp($lista);
  64.  
  65.     open DIRS, $dirs;
  66.  
  67.     foreach $dir(<DIRS>)
  68.  
  69.     {
  70.  
  71.         chomp($dir);
  72.  
  73.         $host = $web.'/~'.$lista.'/'.$dir;
  74.  
  75.         $req = HTTP::Request->new(GET => "$host");
  76.  
  77.         $res = $ua->request($req);
  78.  
  79.         $result = $res->code;
  80.  
  81.         if ($result != 404 and $result != 403)
  82.  
  83.         {
  84.  
  85.             print "\n".$res->status_line.": $host";
  86.  
  87.             print SAVE $res->status_line.' : <a href="'.$host.'" TARGET="_new">'.$host.'</a><br>';
  88.  
  89.         }
  90.  
  91.     }
  92.  
  93.     close(DIRS);
  94.  
  95. }
  96.  
  97.  
  98.  
  99. print "\n";
  100.  
  101. close(USERS,SAVE);
  102.  
  103.  
  104.  
  105. __END__
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement