#!/usr/bin/perl
##########################################################################################
#Coded bY boER #
# #
#Edited by B47CH GURU on 06-07-2011 #
#if any bugs are found ...plz do inform me at interestingpal@gmail.com #
#----------------------------------------------------------------------------------------#
#To all script kiddies..... changing the "made by" headers wont make you the coder...!! #
#Respect the coderz..!!! #
##########################################################################################
use LWP::UserAgent;
my $ua = LWP::UserAgent->new();
$ua->timeout (10);
$ua->agent("Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.3) Gecko/20010801");
$list =$ARGV[0];
$loged =$ARGV[1];
$option =$ARGV[2];
$u="adminfinder -"&$list&" "&$logged&" "&$option;
unless($ARGV[1]){
if($^O =~ /Win/){
system("cls");
system("title " & $u);
}else{
system("clear");
}
print ("##############################################################\n");
print ("\nUsage: perl <website_list.txt> <log.txt> [optional <option>]\n");
print ("\n");
print ("-------------------------------------------------------------\n");
print ("1- detects every admin page but only writes the first found\n");
print ("2- if one admin page found then dont check for other\n");
print ("3- detects everything and logs everything\n");
print ("\n");
print (" -------------------\n");
print ("|Default option is 3|\n");
print (" -------------------\n");
print ("\n");
print ("-------------------------------------------------------------\n");
print ("\n#############################################################\n");
exit(0);
}
if($^O =~ /Win/){
system("cls");
}else{
system("clear");
}
#Bhai here you can Toggle your default option
##############################################
if($option==''){
$option=3;
}
#############################################
print ("#######################################################\n");
print (" Scanner Directory!\n");
print ("#######################################################\n");
print (" 200 - OK\n");
print (" 401 - Authorization Required\n");
print (" 403 - Forbidden\n");
print (" 500 - Bad Hostname | Internal Server Error\n");
print ("\n");
print (" ------------\n");
print ("|option is $option|\n");
print (" ------------\n");
print ("########################################################\n");
$webcl = clear($ARGV[0]);
open FILE, "+>$loged" or die $!;
@paths = ("/admin/","/admin/login.php","/login.php");
$web = $webcl;
$ast = 0;
$astr=1;
brute();
print ("\n# Scanning Finished\n");
sub brute{
$web = shift;
@paths = ("/admin/","/admin/login.php","/login.php");
open (PASSFILE, "<$list") || die "[-] Can't open the Website list !";
@PASSWORDS = <PASSFILE>;
close PASSFILE;
loop: foreach $P(@PASSWORDS) {
chomp($P);
$webcl=$P;
$webcl = trim($webcl);
$webcl = clear($webcl);
print ("\n# Scanning: $webcl\n\n");
@paths = ("/admin/","/admin/login.php","/login.php");
$ast=0;
$astr=1;
foreach $path(@paths){
chomp($path);
$code = $ua->get($webcl . $path)->status_line;
if($option=~/1/){
check_codefirst($code,$path,$astr);
}
if($option=~/2/){
check_codesec($code,$path);
}
if($option=~/3/){
check_codethr($code,$path);
}
if($ast=~1){
next loop;
}
}
}
close FILE;
}
sub check_codesec{
$ncode = shift;
$path = shift;
$wp = $webcl . $path;
if($ncode =~ /200/){
print ("$wp\t=>\t200 OK\n");
$ast = 1;
print FILE "$wp\n";
}
if($ncode =~ /401/){
print ("$wp\t=>\t401 Authorization Required\n");
}
if($ncode =~ /403/){
print ("$wp\t=>\t403 Forbidden\n");
}
if($ncode =~ /500/){
print ("$wp\t=>\t500 Internal Server Error\n");
}
if($ncode =~ /Moved/){
print ("$wp\t=>\t500 Moved\n");
print FILE $wp;
$ast = 1;
}
}
sub check_codefirst{
$ncode = shift;
$path = shift;
$astr = shift;
$wp = $webcl . $path;
if($ncode =~ /200/){
print ("$wp\t=>\t200 OK\n");
if($astr=~ /1/){
print FILE "$wp\n";
}
$astr=0
}
if($ncode =~ /401/){
print ("$wp\t=>\t401 Authorization Required\n");
}
if($ncode =~ /403/){
print ("$wp\t=>\t403 Forbidden\n");
}
if($ncode =~ /500/){
print ("$wp\t=>\t500 Internal Server Error\n");
}
if($ncode =~ /Moved/){
print ("$wp\t=>\t500 Moved\n");
if ($astr=~ /1/){
print FILE "$wp\n";
}
$astr=0
}
}
sub check_codethr{
$ncode = shift;
$path = shift;
$wp = $webcl . $path;
if($ncode =~ /200/){
print ("$wp\t=>\t200 OK\n");
print FILE "$wp\n";
}
if($ncode =~ /401/){
print ("$wp\t=>\t401 Authorization Required\n");
}
if($ncode =~ /403/){
print ("$wp\t=>\t403 Forbidden\n");
}
if($ncode =~ /500/){
print ("$wp\t=>\t500 Internal Server Error\n");
}
if($ncode =~ /Moved/){
print ("$wp\t=>\t500 Moved\n");
print FILE $wp;
}
}
sub clear{
$website = shift;
if($website !~ /^http/){
$website = 'http://www.' . $website;
}
return $website;
}
sub trim{
$string = shift;
$string =~ s/^\s+//;
$string =~ s/\s+$//;
return $string;
}
abril 30, 2012