Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl -w
- use IO::Socket;
- use Getopt::Std;
- use Parallel::ForkManager;
- my %opts;
- getopt ("h: l: p: e: s: t:" ,\%opts);
- use LWP;
- if (!(exists $opts{h})||!(exists $opts{p})||!(exists $opts{l})||!(exists $opts{e})){ &usage;}
- sub usage{
- print "\#############################################\n";
- print "\# APACHE "MOD_USERDIR" USER ENUMERATION #\n";
- print "\# by cpt.simmons #\n";
- print "\# #\n";
- print "\#############################################\n";
- print "\--------------------------------------------- \n";
- 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 ";
- print "\---------------------------------------------\n";
- print "\ example : perl apache.pl -h 192.168.1.107 -l wordlist.txt -p 80 -s 0 -e 403 -t 10 \n";
- exit 1;
- };
- if (exists $opts{h}){
- $host=$opts{h};
- }
- if (exists $opts{l}){
- $list=$opts{l};
- }else {$list="names";}
- if (exists $opts{p}){
- $port=$opts{p};
- }else{$port=80;}
- if (exists $opts{e}){
- $num=$opts{e};
- }else{$num=403;}
- if (exists $opts{s}){
- $ssl=$opts{s};
- }else{$ssl=0;}
- if (exists $opts{t}){
- $threads=$opts{t};
- }else{$threads=1;}
- if($ssl==0){
- $main_loop=new Parallel::ForkManager($threads);
- open (LIST, "<$list") or die "Unable to open $list ....$!";
- foreach $name (<LIST>) {
- $main_loop->start and next;
- chomp $name;
- $page="~".$name.'/';
- $url = 'http://'.$host.':'.$port.'/'.$page;
- $browser = LWP::UserAgent->new;
- $browser->agent("Apache");
- $response = $browser->get($url);
- #print $response->status_line."\n";
- if ( $response->status_line =~/($num)/g ) {
- print "[+] Found : $name exists on $host\n";
- }
- $main_loop->finish;
- }
- $main_loop->wait_all_children;
- }else{
- $main_loop=new Parallel::ForkManager($threads);
- open (LIST, "<$list") or die "Unable to open $list ....$!";
- foreach $name (<LIST>) {
- $main_loop->start and next;
- chomp $name;
- $page="~".$name.'/';
- $url = 'https://'.$host.':'.$port.'/'.$page; # Yes, HTTPS!
- $browser = LWP::UserAgent->new;
- $browser->agent("Apache");
- $response = $browser->get($url);
- #print $response->status_line."\n";
- if ( $response->status_line =~/($num)/g ) {
- print " [+] Found : $name exists on $host\n";
- }
- $main_loop->finish;
- }
- $main_loop->wait_all_children;
- }
- print "Execution ". (time - $^T) . " seconds!\n";
- close LIST;
- exit 1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement