Merge pull request #2602 from roycewilliams/master

test.pl: add 'potthrough' (like passthrough, but hash:plain)
pull/2777/head
Jens Steube 3 years ago committed by GitHub
commit bd53f4a763
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -23,7 +23,7 @@ if (exists $ENV{"IS_OPTIMIZED"} && defined $ENV{"IS_OPTIMIZED"})
$IS_OPTIMIZED = $ENV{"IS_OPTIMIZED"}; $IS_OPTIMIZED = $ENV{"IS_OPTIMIZED"};
} }
my $TYPES = [ 'single', 'passthrough', 'verify' ]; my $TYPES = [ 'single', 'passthrough', 'potthrough', 'verify' ];
my $TYPE = shift @ARGV; my $TYPE = shift @ARGV;
my $MODE = shift @ARGV; my $MODE = shift @ARGV;
@ -53,6 +53,10 @@ elsif ($TYPE eq 'passthrough')
{ {
passthrough (); passthrough ();
} }
elsif ($TYPE eq 'potthrough')
{
passthrough ('potthrough');
}
elsif ($TYPE eq "verify") elsif ($TYPE eq "verify")
{ {
usage_exit () if scalar @ARGV != 3; usage_exit () if scalar @ARGV != 3;
@ -164,6 +168,8 @@ sub single
sub passthrough sub passthrough
{ {
my $option = shift || '';
while (my $word = <>) while (my $word = <>)
{ {
chomp $word; chomp $word;
@ -222,7 +228,14 @@ sub passthrough
next unless defined $hash; next unless defined $hash;
print "$hash\n"; if ($option eq 'potthrough')
{
print "$hash:$word\n";
}
else
{
print "$hash\n";
}
} }
} }
} }
@ -576,6 +589,7 @@ sub usage_exit
. "Usage:\n" . "Usage:\n"
. " $f single <mode> [length]\n" . " $f single <mode> [length]\n"
. " $f passthrough <mode>\n" . " $f passthrough <mode>\n"
. " $f potthrough <mode>\n"
. " $f verify <mode> <hashfile> <cracksfile> <outfile>\n" . " $f verify <mode> <hashfile> <cracksfile> <outfile>\n"
. "\n" . "\n"
. "Single:\n" . "Single:\n"
@ -586,11 +600,16 @@ sub usage_exit
. "Passthrough:\n" . "Passthrough:\n"
. " Generates hashes for strings entered via stdin and prints them to stdout.\n" . " Generates hashes for strings entered via stdin and prints them to stdout.\n"
. "\n" . "\n"
. "Potthrough:\n"
. " Like passthrough, but includes both the hash and the plain in hash:plain format,\n"
. " similar to the classic potfile format.\n"
. "\n"
. "Verify:\n" . "Verify:\n"
. " Reads a list of hashes from <hashfile> and a list of hash:password pairs from\n" . " Reads a list of hashes from <hashfile> and a list of hash:password pairs from\n"
. " <cracksfile>. Hashes every password and compares the hash to the corresponding\n" . " <cracksfile>. Hashes every password and compares the hash to the corresponding\n"
. " entry in the <cracksfile>. If the hashes match and the hash is present in the\n" . " entry in the <cracksfile>. If the hashes match and the hash is present in the\n"
. " list from <hashfile>, it will be written to the <outfile>.\n"; . " list from <hashfile>, it will be written to the <outfile>.\n"
. "\n";
exit 1; exit 1;
} }

Loading…
Cancel
Save