nessa video aula eu ensino a quebrar hash md5 e sha1 com script crack_beta
[Tens de ter uma conta e sessão iniciada para poderes visualizar este link]
- Código:
#!/usr/bin/perl
#Version 1.1b6
use Digest::MD5 qw(md5_hex);
use Digest::SHA1 qw(sha1_hex);
use Term::ANSIColor qw(:constants);
print "An md5/sha1 Digest cracker designed by KALGECIN\n";
print "kalgecin\@gmail.com\n";
my $type=$ARGV[2];
my $hash=$ARGV[0];
my $file=$ARGV[1];
my $md5="md5";
my $sha1="sha1";
my $computedhash="";
my $pass="";
my $x;
my $done = 0;
my $timeg;
my $timea;
my $status;
my $timediff;
my $one; $two; $three; $four; $five; $six; $seven; $eight;
my $a; $b; $c; $d; $e; $f; $g; $h;
my $cnt2;
my $bm1; $bm2;
my $left;
if($hash eq "" || $file eq ""){
print "Usage : $0 <hash|table> <password file>|bruteforce> [md5|sha1]\n";
if($hash eq "benchmark"){
}
else{
print "Exit\n";
exit();
}
}
if(length($hash)==32){
$type="md5";
}
elsif(length($hash)==40){
$type="sha1";
}
elsif($hash eq "benchmark"){
$type="benchmark";
print "Benchmarking\n";
}
elsif($hash eq "table") {
if($type eq ""){
print "Usage : $0 table <password file|bruteforce> <md5|sha1>\n";
exit();
}
if($type eq "md5"){
print "Generating MD5 table\n";
}
elsif($type eq "sha1"){
print "Generating SHA1 table\n";
}
else{
print "Usage : $0 table <password file|bruteforce> <md5|sha1>\n";
exit();
}
print "Generating table\n";
}
else{
print "Invalid Hash\n";
exit();
}
$timeg = time;
#print "Started at $timeg";
if($type eq "benchmark"){
my $hash1 = "02c425157ecd32f259548b33402ff6d3"; #md5
my $hash2 = "cb990257247b592eaaed54b84b32d96b7904fd95"; #sha1
print "Started BenchMarking\n";
@letters=("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","1","2","3","4","5","6","7","8","9","0");
$cnt2 = @letters;
for($a=0;$a<$cnt2;$a++){
for($b=0;$b<$cnt2;$b++){
for($c=0;$c<$cnt2;$c++){
for($d=0;$d<$cnt2;$d++){
for($e=0;$e<$cnt2;$e++){
for($f=0;$f<$cnt2;$f++){
for($g=0;$g<$cnt2;$g++){
for($h=0;$h<$cnt2;$h++){
$passtotest=$one . $two . $three . $four . $five . $six . $seven . $eight;
$timea=time-$timeg;
if($timea!=0){
$status=$done/$timea;
}
else{
$status="Underfined";
}
if($bm1!=1){
$computedhash=md5_hex($passtotest);
if($computedhash eq $hash1){
printf "\nComputed md5 in $timea s (%.1f c/s)\n",$status;
$bm1=1;
}
}
if($bm2!=1){
$computedhash=sha1_hex($passtotest);
if($computedhash eq $hash2){
printf "\nComputed sha1 in $timea s (%.1f c/s)\n",$status;
$bm2=1;
}
}
if($bm1==1 && $bm2==1){
exit();
}
$done++;
$eight=$letters[$h];
}
$seven=$letters[$g];
}
$six=$letters[$f];
}
$five=$letters[$e];
}
$four=$letters[$d];
}
$three=$letters[$c];
}
$two=$letters[$b];
}
$one=$letters[$a];
}
}
if($file eq "bruteforce"){
#Uncomment the characterset that you would like to use. Make sure that there is only ONE uncommented characterset
#@letters=("!","@","#","\$","%","^","&","*","(",")","_","+","-","=","?",">","<",";",":","{","}","[","]","\\","|" ,"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","0","1","2","3","4","5","6","7","8","9");
@letters=("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","1","2","3","4","5","6","7","8","9","0");
#@letters=("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z");
#@letters=("0","1","2","3","4","5","6","7","8","9");
$cnt2 = @letters;
print "$cnt2 characters found\n";
if($hash eq "table"){
$seven=$letters[$g];
$six=$letters[$f];
$five=$letters[$e];
$four=$letters[$d];
$three=$letters[$c];
}
for($a=0;$a<$cnt2;$a++){
for($b=0;$b<$cnt2;$b++){
for($c=0;$c<$cnt2;$c++){
for($d=0;$d<$cnt2;$d++){
for($e=0;$e<$cnt2;$e++){
for($f=0;$f<$cnt2;$f++){
for($g=0;$g<$cnt2;$g++){
for($h=0;$h<$cnt2;$h++){
$passtotest=$one . $two . $three . $four . $five . $six . $seven . $eight;
$timea=time-$timeg;
if($timea!=0){
$status=$done/$timea;
}
else{
$timea="Undefined";
}
if($timediff>1000){
$timediff=0;
printf "$passtotest -> $done Done -> $timea s (%.1f c/s) \r", $status;
}
if($timediff<=1000){
$timediff++;
}
if($type eq $md5)
{
$computedhash=md5_hex($passtotest);
if($hash eq "table"){
print "$computedhash : $passtotest\n";
}
}
elsif($type eq $sha1)
{
$computedhash=sha1_hex($passtotest);
if($hash eq "table"){
print "$computedhash : $passtotest\n";
}
}
if($computedhash eq $hash){
print RED, "$hash is $passtotest\n", RESET;
print "Time used : $timea s\n";
if($timea>0){
$status=$done/$timea;
}
else{
$status="Undefined";
}
printf "Computed $done in $timea s (%.1f c/s)\n",$status;
$done=0;
exit();
}
$done++;
$eight=$letters[$h];
}
$seven=$letters[$g];
}
$six=$letters[$f];
}
$five=$letters[$e];
}
$four=$letters[$d];
}
$three=$letters[$c];
}
$two=$letters[$b];
}
$one=$letters[$a];
}
}
else{
print "Preparing for cracking....\n";
open INPUT_FILE, $file;
@passwords=<INPUT_FILE>;
chomp(@passwords);
$cnt=@passwords;
print "Loaded $cnt passwords\nCracking $type\n";
for($x=0;$x<=$cnt;$x++){
if($timea>30){
exit();
}
$timea=time-$timeg;
if($timediff>1000){
$timediff=0;
$left=$cnt-$done;
print "$pass -> $done Done -> $timea s \t($left left) \r";
}
if($timediff<=1000){
$timediff++;
}
$pass=@passwords[$x];
if($type eq $md5)
{
$computedhash=md5_hex($pass);
if($hash eq "table"){
print "$computedhash : $pass\n";
}
}
elsif($type eq $sha1)
{
$computedhash=sha1_hex($pass);
if($hash eq "table"){
print "$computedhash : $pass\n";
}
}
if($computedhash eq $hash){
print RED, "$hash is $pass\n", RESET;
print "Time used : $timea s\n";
if($timea!=0){
$status=$done/$timea;
}
if($timea==0){
$status="Undeffined";
}
printf "Read $done passwords in $timea s (%.1f c/s)\n",$status;
print "\nFinnished\n";
$done=0;
exit();
}
$done++;
}
if($timea!=0){
$status=$done/$timea;
}
if($timea==0){
$status="Undeffined";
}
printf "Read $done passwords in $timea (%.1f c/s)\n",$status;
print "\nFinnished\n";
}