Advertisement
Guest User

Untitled

a guest
Aug 30th, 2014
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.68 KB | None | 0 0
  1. #!/usr/bin/env perl
  2.  
  3. use Crypt::PBKDF2;
  4.  
  5. if (@ARGV < 2)
  6. {
  7.   print "[!] Error: please specify hash (first argument) and salt (second argument)\n";
  8.   exit (1);
  9. }
  10.  
  11. my $match = pack ("H*", $ARGV[0]); # TODO: check if it is of lenght 40
  12. my $salt  = pack ("H*", $ARGV[1]); # of length 8?
  13. my $iter  = 1000;
  14.  
  15. my $pbkdf2 = Crypt::PBKDF2->new (hash_class => 'HMACSHA1', iterations => $iter);
  16.  
  17. my $num;
  18.  
  19. for ($num = 0; $num < 10000; $num++)
  20. {
  21.   my $pass = sprintf ("%04d", $num);
  22.  
  23.   my $hash = $pbkdf2->PBKDF2 ($salt, $pass);
  24.  
  25.   if ($match eq $hash)
  26.   {
  27.     printf ("%s:%s:%s:%s\n", unpack ("H*", $hash), unpack ("H*", $salt), $iter, $pass);
  28.     exit (0);
  29.   }
  30. }
  31. exit (1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement