1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-22 16:18:09 +00:00

test.pl: add 'potthrough' (like passthrough, but plain:hash)

This commit is contained in:
Royce Williams 2020-10-31 17:55:55 -08:00
parent 15bf8b7302
commit 4edb4b923e

View File

@ -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;
} }