Advertisement
cpt-simmonS

APACHE "MOD_USERDIR"

Aug 4th, 2016
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.51 KB | None | 0 0
  1. #!/usr/bin/perl -w
  2.  
  3.  
  4.  
  5. use IO::Socket;
  6. use Getopt::Std;
  7. use Parallel::ForkManager;
  8. my %opts;
  9. getopt ("h: l: p: e: s: t:" ,\%opts);
  10. use LWP;
  11.  
  12.  
  13. if (!(exists $opts{h})||!(exists $opts{p})||!(exists $opts{l})||!(exists $opts{e})){ &usage;}
  14.  
  15. sub usage{
  16. print "\#############################################\n";
  17. print "\# APACHE "MOD_USERDIR" USER ENUMERATION #\n";
  18. print "\# by cpt.simmons #\n";
  19. print "\# #\n";
  20. print "\#############################################\n";
  21. print "\--------------------------------------------- \n";
  22. print "\ using : apache.pl -h server ip -l wordlist -p 80 -s (SSL Support 1=true 0=false) -e 403 (http code) -t threads \n ";
  23. print "\---------------------------------------------\n";
  24. print "\ example : perl apache.pl -h 192.168.1.107 -l wordlist.txt -p 80 -s 0 -e 403 -t 10 \n";
  25. exit 1;
  26. };
  27.  
  28. if (exists $opts{h}){
  29. $host=$opts{h};
  30. }
  31. if (exists $opts{l}){
  32. $list=$opts{l};
  33. }else {$list="names";}
  34. if (exists $opts{p}){
  35. $port=$opts{p};
  36. }else{$port=80;}
  37. if (exists $opts{e}){
  38. $num=$opts{e};
  39. }else{$num=403;}
  40. if (exists $opts{s}){
  41. $ssl=$opts{s};
  42. }else{$ssl=0;}
  43. if (exists $opts{t}){
  44. $threads=$opts{t};
  45. }else{$threads=1;}
  46.  
  47. if($ssl==0){
  48. $main_loop=new Parallel::ForkManager($threads);
  49. open (LIST, "<$list") or die "Unable to open $list ....$!";
  50. foreach $name (<LIST>) {
  51. $main_loop->start and next;
  52. chomp $name;
  53. $page="~".$name.'/';
  54. $url = 'http://'.$host.':'.$port.'/'.$page;
  55. $browser = LWP::UserAgent->new;
  56. $browser->agent("Apache");
  57. $response = $browser->get($url);
  58. #print $response->status_line."\n";
  59. if ( $response->status_line =~/($num)/g ) {
  60. print "[+] Found : $name exists on $host\n";
  61. }
  62. $main_loop->finish;
  63. }
  64. $main_loop->wait_all_children;
  65. }else{
  66. $main_loop=new Parallel::ForkManager($threads);
  67. open (LIST, "<$list") or die "Unable to open $list ....$!";
  68. foreach $name (<LIST>) {
  69. $main_loop->start and next;
  70. chomp $name;
  71. $page="~".$name.'/';
  72. $url = 'https://'.$host.':'.$port.'/'.$page; # Yes, HTTPS!
  73. $browser = LWP::UserAgent->new;
  74. $browser->agent("Apache");
  75. $response = $browser->get($url);
  76. #print $response->status_line."\n";
  77. if ( $response->status_line =~/($num)/g ) {
  78. print " [+] Found : $name exists on $host\n";
  79. }
  80. $main_loop->finish;
  81. }
  82. $main_loop->wait_all_children;
  83. }
  84. print "Execution ". (time - $^T) . " seconds!\n";
  85. close LIST;
  86. exit 1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement