1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-22 22:58:30 +00:00

allow --left and -o work with binary hash files

This commit is contained in:
philsmd 2020-06-15 15:43:49 +02:00
parent 4ac772d272
commit 437e9aa3d1
No known key found for this signature in database
GPG Key ID: 4F25D016D9D6A8AF
4 changed files with 16 additions and 10 deletions

View File

@ -20,6 +20,6 @@ int outfile_init (hashcat_ctx_t *hashcat_ctx);
void outfile_destroy (hashcat_ctx_t *hashcat_ctx);
int outfile_write_open (hashcat_ctx_t *hashcat_ctx);
void outfile_write_close (hashcat_ctx_t *hashcat_ctx);
int outfile_write (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const int out_len, const unsigned char *plain_ptr, const u32 plain_len, const u64 crackpos, const unsigned char *username, const u32 user_len, char tmp_buf[HCBUFSIZ_LARGE]);
int outfile_write (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const int out_len, const unsigned char *plain_ptr, const u32 plain_len, const u64 crackpos, const unsigned char *username, const u32 user_len, const bool print_eol, char tmp_buf[HCBUFSIZ_LARGE]);
#endif // _OUTFILE_H

View File

@ -386,7 +386,7 @@ void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl
tmp_buf[0] = 0;
const int tmp_len = outfile_write (hashcat_ctx, (char *) out_buf, out_len, plain_ptr, plain_len, crackpos, NULL, 0, (char *) tmp_buf);
const int tmp_len = outfile_write (hashcat_ctx, (char *) out_buf, out_len, plain_ptr, plain_len, crackpos, NULL, 0, true, (char *) tmp_buf);
EVENT_DATA (EVENT_CRACKER_HASH_CRACKED, tmp_buf, tmp_len);

View File

@ -538,7 +538,7 @@ void outfile_write_close (hashcat_ctx_t *hashcat_ctx)
hc_fclose (&outfile_ctx->fp);
}
int outfile_write (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const int out_len, const unsigned char *plain_ptr, const u32 plain_len, const u64 crackpos, const unsigned char *username, const u32 user_len, char tmp_buf[HCBUFSIZ_LARGE])
int outfile_write (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const int out_len, const unsigned char *plain_ptr, const u32 plain_len, const u64 crackpos, const unsigned char *username, const u32 user_len, const bool print_eol, char tmp_buf[HCBUFSIZ_LARGE])
{
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
const user_options_t *user_options = hashcat_ctx->user_options;
@ -687,8 +687,12 @@ int outfile_write (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const int ou
if (outfile_ctx->fp.pfp != NULL)
{
hc_fwrite (tmp_buf, tmp_len, 1, &outfile_ctx->fp);
hc_fwrite (EOL, strlen (EOL), 1, &outfile_ctx->fp);
hc_fwrite (tmp_buf, tmp_len, 1, &outfile_ctx->fp);
if (print_eol == true)
{
hc_fwrite (EOL, strlen (EOL), 1, &outfile_ctx->fp);
}
}
return tmp_len;

View File

@ -768,7 +768,7 @@ int potfile_handle_show (hashcat_ctx_t *hashcat_ctx)
}
}
const int tmp_len = outfile_write (hashcat_ctx, (char *) out_buf, out_len, (u8 *) mixed_buf, mixed_len, 0, username, user_len, (char *) tmp_buf);
const int tmp_len = outfile_write (hashcat_ctx, (char *) out_buf, out_len, (u8 *) mixed_buf, mixed_len, 0, username, user_len, true, (char *) tmp_buf);
//EVENT_DATA (EVENT_POTFILE_HASH_SHOW, tmp_buf, tmp_len);
@ -852,11 +852,11 @@ int potfile_handle_show (hashcat_ctx_t *hashcat_ctx)
const size_t 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, out_len, pass_unhexified, (u32) pass_unhexified_len, 0, username, user_len, (char *) tmp_buf);
tmp_len = outfile_write (hashcat_ctx, (char *) out_buf, out_len, pass_unhexified, (u32) pass_unhexified_len, 0, username, user_len, true, (char *) tmp_buf);
}
else
{
tmp_len = outfile_write (hashcat_ctx, (char *) out_buf, out_len, (u8 *) hash->pw_buf, hash->pw_len, 0, username, user_len, (char *) tmp_buf);
tmp_len = outfile_write (hashcat_ctx, (char *) out_buf, out_len, (u8 *) hash->pw_buf, hash->pw_len, 0, username, user_len, true, (char *) tmp_buf);
}
//EVENT_DATA (EVENT_POTFILE_HASH_SHOW, tmp_buf, tmp_len);
@ -977,7 +977,7 @@ int potfile_handle_left (hashcat_ctx_t *hashcat_ctx)
tmp_buf[0] = 0;
const int tmp_len = outfile_write (hashcat_ctx, (char *) out_buf, out_len, NULL, 0, 0, username, user_len, (char *) tmp_buf);
const int tmp_len = outfile_write (hashcat_ctx, (char *) out_buf, out_len, NULL, 0, 0, username, user_len, true, (char *) tmp_buf);
//EVENT_DATA (EVENT_POTFILE_HASH_LEFT, tmp_buf, tmp_len);
@ -1058,11 +1058,13 @@ int potfile_handle_left (hashcat_ctx_t *hashcat_ctx)
}
}
const bool print_eol = (hashconfig->opts_type & OPTS_TYPE_BINARY_HASHFILE) == 0;
u8 *tmp_buf = potfile_ctx->tmp_buf;
tmp_buf[0] = 0;
const int tmp_len = outfile_write (hashcat_ctx, (char *) out_buf, out_len, NULL, 0, 0, username, user_len, (char *) tmp_buf);
const int tmp_len = outfile_write (hashcat_ctx, (char *) out_buf, out_len, NULL, 0, 0, username, user_len, print_eol, (char *) tmp_buf);
//EVENT_DATA (EVENT_POTFILE_HASH_LEFT, tmp_buf, tmp_len);