Skip to content

Instantly share code, notes, and snippets.

@mhasbini
Created June 20, 2016 18:02
Show Gist options
  • Save mhasbini/127877865fc8575f0476c94d1d68e339 to your computer and use it in GitHub Desktop.
Save mhasbini/127877865fc8575f0476c94d1d68e339 to your computer and use it in GitHub Desktop.
use String::Random;
use Data::Dumper;
use Time::HiRes qw(time);
my $str = String::Random->new();
$str->{'w'} = [ @{$str->{'C'}}, @{$str->{'c'}} ];
$str->{'N'} = [ @{$str->{'w'}}, @{$str->{'n'}} ];
use constant {
STR_NUM => 100,
LENGTH_MAX => 80
};
# c [a-z]
# C [A-Z]
# n [0-9]
# w cC
# N cCn
# ! [~`!@$%^&*()-_+={}[]|\:;"'.<>?/#,]
# . cCn!
# s [A-Za-z0-9./]
# b 0x00-0xff
my $out_file = 'hashcat-wlist.txt';
my $tick = time;
my $pat_number = 0;
open my $OUT, '>', $out_file or die $!;
foreach my $pat (qw/c C n ! . b w N s/)
{
for(my $i = 1; $i <= LENGTH_MAX; $i++) # foreach $i length, generate strings, up to LENGTH_MAX
{
for(my $j = 1; $j <= STR_NUM; $j++) # foreach $pat with $i length, generate STR_NUM strings
{
print $OUT $str->randpattern($pat x $i),"\n";
$pat_number++;
}
}
}
close $OUT;
print "Generated $pat_number patterns in ". stime(time - $tick) ."s\n";
sub stime {
my $time = shift;
return int($time*1000)/1000;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment