1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-24 15:38:11 +00:00

Merge pull request #1343 from philsmd/master

fixes show output of -m 9710, -m 9810 and -m 10410
This commit is contained in:
Jens Steube 2017-08-25 10:02:17 +02:00 committed by GitHub
commit b58da88174
3 changed files with 39 additions and 6 deletions

View File

@ -33,6 +33,7 @@
- Fixed the parsing of command line options. It doesn't show two times the same error about an invalid option anymore
- Fixed the parsing of DCC2 hashes by allowing the "#" character within the user name
- Fixed the parsing of descrypt hashes if the hashes do have non-standard characters within the salt
- Fixed the output of --show when used together with the collider modes -m 9710, 9810 or 10410
- Fixed the version number used in the restore file header
##

View File

@ -97,6 +97,12 @@ bool is_hexify (const u8 *buf, const int len)
{
if (len < 6) return false; // $HEX[] = 6
// length of the hex string must be a multiple of 2
// and the length of "$HEX[]" is 6 (also an even length)
// Therefore the overall length must be an even number:
if ((len & 1) == 1) return false;
if (buf[0] != '$') return (false);
if (buf[1] != 'H') return (false);
if (buf[2] != 'E') return (false);
@ -155,15 +161,12 @@ bool need_hexify (const u8 *buf, const int len, const char separator, bool alway
// also test if the password is of the format $HEX[]:
if (rc == false)
{
if ((len & 1) == 0)
{
if (is_hexify (buf, len))
{
rc = true;
}
}
}
return rc;
}

View File

@ -734,7 +734,36 @@ int potfile_handle_show (hashcat_ctx_t *hashcat_ctx)
tmp_buf[0] = 0;
const int tmp_len = outfile_write (hashcat_ctx, (char *) out_buf, (u8 *) hash->pw_buf, hash->pw_len, 0, username, user_len, (char *) tmp_buf);
// special case for collider modes: we do not use the $HEX[] format within the hash itself
// therefore we need to convert the $HEX[] password into hexadecimal (without "$HEX[" and "]")
bool is_collider_hex_password = false;
if ((hashconfig->hash_mode == 9710) || (hashconfig->hash_mode == 9810) || (hashconfig->hash_mode == 10410))
{
if (is_hexify ((u8 *) hash->pw_buf, hash->pw_len) == true)
{
is_collider_hex_password = true;
}
}
int tmp_len = 0;
if (is_collider_hex_password == true)
{
u8 pass_unhexified[HCBUFSIZ_TINY] = { 0 };
u32 pass_unhexified_len = 0;
pass_unhexified_len = exec_unhexify ((u8 *) hash->pw_buf, hash->pw_len, pass_unhexified, sizeof (pass_unhexified));
tmp_len = outfile_write (hashcat_ctx, (char *) out_buf, pass_unhexified, pass_unhexified_len, 0, username, user_len, (char *) tmp_buf);
}
else
{
tmp_len = outfile_write (hashcat_ctx, (char *) out_buf, (u8 *) hash->pw_buf, hash->pw_len, 0, username, user_len, (char *) tmp_buf);
}
EVENT_DATA (EVENT_POTFILE_HASH_SHOW, tmp_buf, tmp_len);
}