minor code style fixes

pull/3249/head
philsmd 2 years ago
parent 8e532e6162
commit a24d723d66
No known key found for this signature in database
GPG Key ID: 4F25D016D9D6A8AF

@ -81,7 +81,8 @@ static void main_log (hashcat_ctx_t *hashcat_ctx, FILE *fp, const int loglevel)
#endif
// color stuff pre
if (is_stdout_terminal()) {
if (is_stdout_terminal ())
{
#if defined (_WIN)
switch (loglevel)
{
@ -111,7 +112,8 @@ static void main_log (hashcat_ctx_t *hashcat_ctx, FILE *fp, const int loglevel)
fwrite (msg_buf, msg_len, 1, fp);
// color stuff post
if (is_stdout_terminal()) {
if (is_stdout_terminal ())
{
#if defined (_WIN)
switch (loglevel)
{

@ -496,7 +496,11 @@ int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig,
pdf_t *pdf = (pdf_t *) hashes->esalts_buf;
// if the password in tmp->out is equal to the padding, then we recovered just the owner-password
if(pdf_tmp->out[0]==padding[0] && pdf_tmp->out[1]==padding[1] && pdf_tmp->out[2]==padding[2] && pdf_tmp->out[3]==padding[3])
if (pdf_tmp->out[0] == padding[0] &&
pdf_tmp->out[1] == padding[1] &&
pdf_tmp->out[2] == padding[2] &&
pdf_tmp->out[3] == padding[3])
{
return snprintf ((char *) dst_buf, dst_sz, "%s (user password not set)", (char *) src_buf);
}
@ -513,6 +517,7 @@ int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig,
bool remove_padding = false;
int i_padding = 0;
for (int i = 0; i < 16; i++)
{
if (u8OutBufPtr[i] == u8OutPadPtr[i_padding] || remove_padding)
@ -527,7 +532,11 @@ int module_build_plain_postprocess (MAYBE_UNUSED const hashconfig_t *hashconfig,
// TODO would be better to actually also verify the u-value whether we've retrieved the correct user-password,
// however, we'd need to include a lot of code/complexity here to do so (or call into 10500 kernel).
// this seems relevant: run_kernel (hashcat_ctx, device_param, KERN_RUN_3, 0, 1, false, 0)
if(pdf_tmp->out[0]==src_buf[0] && pdf_tmp->out[1]==src_buf[1] && pdf_tmp->out[2]==src_buf[2] && pdf_tmp->out[3]==src_buf[3])
if (pdf_tmp->out[0] == src_buf[0] &&
pdf_tmp->out[1] == src_buf[1] &&
pdf_tmp->out[2] == src_buf[2] &&
pdf_tmp->out[3] == src_buf[3])
{
if (pdf->u_pass_len == 0)
{

@ -944,8 +944,7 @@ void hash_info (hashcat_ctx_t *hashcat_ctx)
{
char *modulefile = (char *) hcmalloc (HCBUFSIZ_TINY);
if (user_options->machine_readable == true)
printf("{ ");
if (user_options->machine_readable == true) printf ("{ ");
for (int i = 0; i < MODULE_HASH_MODES_MAXIMUM; i++)
{
@ -970,8 +969,7 @@ void hash_info (hashcat_ctx_t *hashcat_ctx)
}
}
if (user_options->machine_readable == true)
printf(" }");
if (user_options->machine_readable == true) printf (" }");
hcfree (modulefile);
}
@ -1789,17 +1787,28 @@ void status_display_status_json (hashcat_ctx_t *hashcat_ctx)
printf ("{ \"session\": \"%s\",", hashcat_status->session);
printf (" \"guess\": {");
if (hashcat_status->guess_base)
{
printf (" \"guess_base\": \"%s\",", hashcat_status->guess_base);
}
else
{
printf (" \"guess_base\": null,");
}
printf (" \"guess_base_count\": %u,", hashcat_status->guess_base_count);
printf (" \"guess_base_offset\": %u,", hashcat_status->guess_base_offset);
printf (" \"guess_base_percent\": %.02f,", hashcat_status->guess_base_percent);
printf (" \"guess_mask_length\": %u,", hashcat_status->guess_mask_length);
if (hashcat_status->guess_mod)
{
printf (" \"guess_mod\": \"%s\",", hashcat_status->guess_mod);
}
else
{
printf (" \"guess_mod\": null,");
}
printf (" \"guess_mod_count\": %u,", hashcat_status->guess_mod_count);
printf (" \"guess_mod_offset\": %u,", hashcat_status->guess_mod_offset);
printf (" \"guess_mod_percent\": %.02f,", hashcat_status->guess_mod_percent);

@ -613,7 +613,8 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
{
if ((user_options->separator[0] == '0') && (user_options->separator[1] == 'x'))
{
if (is_valid_hex_string((u8 * )(&(user_options->separator[2])),2)){
if (is_valid_hex_string ((u8 * ) (&(user_options->separator[2])), 2))
{
u8 sep = hex_to_u8 ((u8 * ) (&(user_options->separator[2])));
user_options->separator[0] = sep;
user_options->separator[1] = 0;
@ -627,7 +628,9 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
error = true;
}
}
if (error){
if (error)
{
event_log_error (hashcat_ctx, "Separator length has to be exactly 1 byte (single char or hex format e.g. 0x09 for TAB)");
return -1;

Loading…
Cancel
Save