mdelatorre

hcmasks.pl

Jul 24th, 2017
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.91 KB | None | 0 0
  1. #!/usr/bin/perl
  2. # hcmasks.pl by epixoip
  3. # calculates hashcat mask for each word, then sorts and prints masks in desc order
  4.  
  5. use strict;
  6. no strict "subs";
  7.  
  8. my %masks = ();
  9.  
  10. sub desc {
  11.         $masks{$b} <=> $masks{$a};
  12. }
  13.  
  14.  
  15. while (<STDIN>)
  16. {
  17.         chomp;
  18.  
  19.         my $mask;
  20.         my @line = split(//);
  21.  
  22.         foreach my $char (@line)
  23.         {
  24.                 if ($char =~ /[a-z]/) {
  25.                         $mask .= "?l";
  26.                 }
  27.                 elsif ($char =~ /[A-Z]/) {
  28.                         $mask .= "?u";
  29.                 }
  30.                 elsif ($char =~ /[0-9]/) {
  31.                         $mask .= "?d";
  32.                 }
  33.                 elsif ($char =~ /[\W_]/) {
  34.                         $mask .= "?s";
  35.                 }
  36.         }
  37.  
  38.         $masks{$mask}++;
  39. }
  40.  
  41. foreach my $mask (sort desc(keys(%masks)))
  42. {
  43.         printf("%10d    %s\n", $masks{$mask}, $mask);
  44. }
Add Comment
Please, Sign In to add comment