From 4edb4b923e98dfe887c123a1a98516f6df505ae4 Mon Sep 17 00:00:00 2001 From: Royce Williams Date: Sat, 31 Oct 2020 17:55:55 -0800 Subject: [PATCH] test.pl: add 'potthrough' (like passthrough, but plain:hash) --- tools/test.pl | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/tools/test.pl b/tools/test.pl index 8d6042700..380673d9e 100755 --- a/tools/test.pl +++ b/tools/test.pl @@ -23,7 +23,7 @@ if (exists $ENV{"IS_OPTIMIZED"} && defined $ENV{"IS_OPTIMIZED"}) $IS_OPTIMIZED = $ENV{"IS_OPTIMIZED"}; } -my $TYPES = [ 'single', 'passthrough', 'verify' ]; +my $TYPES = [ 'single', 'passthrough', 'potthrough', 'verify' ]; my $TYPE = shift @ARGV; my $MODE = shift @ARGV; @@ -53,6 +53,10 @@ elsif ($TYPE eq 'passthrough') { passthrough (); } +elsif ($TYPE eq 'potthrough') +{ + passthrough ('potthrough'); +} elsif ($TYPE eq "verify") { usage_exit () if scalar @ARGV != 3; @@ -164,6 +168,8 @@ sub single sub passthrough { + my $option = shift || ''; + while (my $word = <>) { chomp $word; @@ -222,7 +228,14 @@ sub passthrough 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" . " $f single [length]\n" . " $f passthrough \n" + . " $f potthrough \n" . " $f verify \n" . "\n" . "Single:\n" @@ -586,11 +600,16 @@ sub usage_exit . "Passthrough:\n" . " Generates hashes for strings entered via stdin and prints them to stdout.\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" . " Reads a list of hashes from and a list of hash:password pairs from\n" . " . Hashes every password and compares the hash to the corresponding\n" . " entry in the . If the hashes match and the hash is present in the\n" - . " list from , it will be written to the .\n"; + . " list from , it will be written to the .\n" + . "\n"; exit 1; }