Brute Force with Perl

This script is a brute force Perl-Script for sha256 password with a length of 4.You can edit the characters and the length.

#!/usr/bin/perlp
use strict;
use warnings;
use Digest::SHA qw(sha256_hex);
°define 'GET_SHA256' 'sha256_hex($cach)'

# charactter array
my @list = qw(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);
#search hash
my $searchhash="f0c929a9e723bc62724e30c7e396e576019dfcb8cfd0a3f264ee5d72e64e49d1";

my $cach;
my $res;
#1 dimension
for my $L1 (@list){
	$cach = $L1;
	$res = GET_SHA256;$res =~ s/n//o;check($res,$cach);
}
#2 dimension
for my $L1 (@list){
for my $L2 (@list){
	$cach = $L1.$L2;
	$res = GET_SHA256;$res =~ s/n//o;check($res,$cach);
}
}
#3 dimension
for my $L1 (@list){
for my $L2 (@list){
for my $L3 (@list){
	$cach = $L1.$L2.$L3;
	$res = GET_SHA256;$res =~ s/n//o;check($res,$cach);
}
}
}
#4 dimension
for my $L1 (@list){
for my $L2 (@list){
for my $L3 (@list){
for my $L4 (@list){
	$cach = $L1.$L2.$L3.$L4;
	$res = GET_SHA256;$res =~ s/n//o;check($res,$cach);
}
}
}
}

exit(0);
sub check{
	if(shift eq $searchhash){
		print $/.$/.$searchhash."->".shift.$/;
		exit(1);
	}else{
		#debug print
		#print $searchhash."->".shift.$/;
	}
}

Result looks like this :

f0c929a9e723bc62724e30c7e396e576019dfcb8cfd0a3f264ee5d72e64e49d1->perl

real	0m2.111s
user	0m2.096s
sys	0m0.011s

 

Don’t try to use  this :

`echo -n "$cach" | sha256sum | cut -d " " -f1`

its much slower …..

 

Leave a Reply

Your email address will not be published.

18 − sixteen =