mirror of
https://github.com/hashcat/hashcat
synced 2024-12-01 20:18:12 +01:00
commit
652a6711a5
@ -84,7 +84,7 @@ int hc_clCreateKernel (hashcat_ctx_t *hashcat_ctx, cl_program program
|
||||
int hc_clCreateProgramWithBinary (hashcat_ctx_t *hashcat_ctx, cl_context context, cl_uint num_devices, const cl_device_id *device_list, const size_t *lengths, const unsigned char **binaries, cl_int *binary_status, cl_program *program);
|
||||
int hc_clCreateProgramWithSource (hashcat_ctx_t *hashcat_ctx, cl_context context, cl_uint count, const char **strings, const size_t *lengths, cl_program *program);
|
||||
int hc_clEnqueueCopyBuffer (hashcat_ctx_t *hashcat_ctx, cl_command_queue command_queue, cl_mem src_buffer, cl_mem dst_buffer, size_t src_offset, size_t dst_offset, size_t size, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event);
|
||||
int hc_clEnqueueMapBuffer (hashcat_ctx_t *hashcat_ctx, cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_map, cl_map_flags map_flags, size_t offset, size_t cb, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event, void **buf);
|
||||
int hc_clEnqueueMapBuffer (hashcat_ctx_t *hashcat_ctx, cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_map, cl_map_flags map_flags, size_t offset, size_t size, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event, void **buf);
|
||||
int hc_clEnqueueNDRangeKernel (hashcat_ctx_t *hashcat_ctx, cl_command_queue command_queue, cl_kernel kernel, cl_uint work_dim, const size_t *global_work_offset, const size_t *global_work_size, const size_t *local_work_size, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event);
|
||||
int hc_clEnqueueReadBuffer (hashcat_ctx_t *hashcat_ctx, cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_read, size_t offset, size_t size, void *ptr, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event);
|
||||
int hc_clEnqueueUnmapMemObject (hashcat_ctx_t *hashcat_ctx, cl_command_queue command_queue, cl_mem memobj, void *mapped_ptr, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event);
|
||||
|
@ -6,7 +6,7 @@
|
||||
#ifndef _HASHES_H
|
||||
#define _HASHES_H
|
||||
|
||||
int sort_by_string (const void *v1, const void *v2);
|
||||
int sort_by_string (const void *p1, const void *p2);
|
||||
int sort_by_digest_p0p1 (const void *v1, const void *v2, void *v3);
|
||||
int sort_by_salt (const void *v1, const void *v2);
|
||||
int sort_by_hash (const void *v1, const void *v2, void *v3);
|
||||
|
@ -25,7 +25,7 @@ int potfile_handle_show (hashcat_ctx_t *hashcat_ctx);
|
||||
int potfile_handle_left (hashcat_ctx_t *hashcat_ctx);
|
||||
|
||||
void potfile_update_hash (hashcat_ctx_t *hashcat_ctx, hash_t *found, char *line_pw_buf, int line_pw_len);
|
||||
void potfile_update_hashes (hashcat_ctx_t *hashcat_ctx, hash_t *search, char *line_pw_buf, int line_pw_len, pot_tree_entry_t *tree);
|
||||
void potfile_update_hashes (hashcat_ctx_t *hashcat_ctx, hash_t *hash_buf, char *line_pw_buf, int line_pw_len, pot_tree_entry_t *tree);
|
||||
|
||||
void pot_tree_destroy (pot_tree_entry_t *tree);
|
||||
|
||||
|
@ -115,6 +115,6 @@ void status_progress_reset (hashcat_ctx_t *hashcat_ct
|
||||
int status_ctx_init (hashcat_ctx_t *hashcat_ctx);
|
||||
void status_ctx_destroy (hashcat_ctx_t *hashcat_ctx);
|
||||
|
||||
void status_status_destroy (hashcat_ctx_t *hashcat_ctx, hashcat_status_t *status_ctx);
|
||||
void status_status_destroy (hashcat_ctx_t *hashcat_ctx, hashcat_status_t *hashcat_status);
|
||||
|
||||
#endif // _STATUS_H
|
||||
|
@ -244,7 +244,7 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
|
||||
{
|
||||
for (int i = 0; i < STEPS_CNT; i++)
|
||||
{
|
||||
const u32 kernel_accel_try = 1u << i;
|
||||
const u32 kernel_accel_try = 1U << i;
|
||||
|
||||
if (kernel_accel_try < kernel_accel_min) continue;
|
||||
if (kernel_accel_try > kernel_accel_max) break;
|
||||
@ -269,8 +269,8 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
|
||||
|
||||
for (int i = 1; i < STEPS_CNT; i++)
|
||||
{
|
||||
const u32 kernel_accel_try = kernel_accel_orig * (1u << i);
|
||||
const u32 kernel_loops_try = kernel_loops_orig / (1u << i);
|
||||
const u32 kernel_accel_try = kernel_accel_orig * (1U << i);
|
||||
const u32 kernel_loops_try = kernel_loops_orig / (1U << i);
|
||||
|
||||
if (kernel_accel_try < kernel_accel_min) continue;
|
||||
if (kernel_accel_try > kernel_accel_max) break;
|
||||
|
130
src/backend.c
130
src/backend.c
@ -259,7 +259,7 @@ static bool setup_opencl_device_types_filter (hashcat_ctx_t *hashcat_ctx, const
|
||||
return false;
|
||||
}
|
||||
|
||||
opencl_device_types_filter |= 1u << device_type;
|
||||
opencl_device_types_filter |= 1U << device_type;
|
||||
|
||||
} while ((next = strtok_r (NULL, ",", &saveptr)) != NULL);
|
||||
|
||||
@ -371,8 +371,8 @@ static bool opencl_test_instruction (hashcat_ctx_t *hashcat_ctx, cl_context cont
|
||||
#ifndef DEBUG
|
||||
#ifndef _WIN
|
||||
fflush (stderr);
|
||||
int bak = dup (2);
|
||||
int tmp = open ("/dev/null", O_WRONLY);
|
||||
int bak = fcntl(2, F_DUPFD_CLOEXEC);
|
||||
int tmp = open ("/dev/null", O_WRONLY | O_CLOEXEC);
|
||||
dup2 (tmp, 2);
|
||||
close (tmp);
|
||||
#endif
|
||||
@ -383,7 +383,11 @@ static bool opencl_test_instruction (hashcat_ctx_t *hashcat_ctx, cl_context cont
|
||||
#ifndef DEBUG
|
||||
#ifndef _WIN
|
||||
fflush (stderr);
|
||||
#ifndef __APPLE__
|
||||
dup3 (bak, 2, O_CLOEXEC);
|
||||
#else
|
||||
dup2 (bak, 2);
|
||||
#endif
|
||||
close (bak);
|
||||
#endif
|
||||
#endif
|
||||
@ -445,7 +449,7 @@ static bool read_kernel_binary (hashcat_ctx_t *hashcat_ctx, const char *kernel_f
|
||||
|
||||
hc_fclose (&fp);
|
||||
|
||||
if (num_read != (size_t) klen)
|
||||
if (num_read != klen)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", kernel_file, strerror (errno));
|
||||
|
||||
@ -469,7 +473,7 @@ static bool read_kernel_binary (hashcat_ctx_t *hashcat_ctx, const char *kernel_f
|
||||
klen += extra_len;
|
||||
}
|
||||
|
||||
kernel_lengths[0] = (size_t) klen;
|
||||
kernel_lengths[0] = klen;
|
||||
|
||||
kernel_sources[0] = buf;
|
||||
}
|
||||
@ -917,14 +921,14 @@ int cuda_init (hashcat_ctx_t *hashcat_ctx)
|
||||
if (cuda->lib == NULL) return -1;
|
||||
|
||||
#define HC_LOAD_FUNC_CUDA(ptr,name,cudaname,type,libname,noerr) \
|
||||
ptr->name = (type) hc_dlsym (ptr->lib, #cudaname); \
|
||||
if (noerr != -1) { \
|
||||
if (!ptr->name) { \
|
||||
if (noerr == 1) { \
|
||||
ptr->name = (type) hc_dlsym ((ptr)->lib, #cudaname); \
|
||||
if ((noerr) != -1) { \
|
||||
if (!(ptr)->name) { \
|
||||
if ((noerr) == 1) { \
|
||||
event_log_error (hashcat_ctx, "%s is missing from %s shared library.", #name, #libname); \
|
||||
return -1; \
|
||||
} \
|
||||
if (noerr != 1) { \
|
||||
if ((noerr) != 1) { \
|
||||
event_log_warning (hashcat_ctx, "%s is missing from %s shared library.", #name, #libname); \
|
||||
return 0; \
|
||||
} \
|
||||
@ -2416,7 +2420,7 @@ int hc_clCreateProgramWithBinary (hashcat_ctx_t *hashcat_ctx, cl_context context
|
||||
|
||||
cl_int CL_err;
|
||||
|
||||
*program = ocl->clCreateProgramWithBinary (context, num_devices, device_list, lengths, (const unsigned char **) binaries, binary_status, &CL_err);
|
||||
*program = ocl->clCreateProgramWithBinary (context, num_devices, device_list, lengths, binaries, binary_status, &CL_err);
|
||||
|
||||
if (CL_err != CL_SUCCESS)
|
||||
{
|
||||
@ -4106,7 +4110,7 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co
|
||||
if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL) innerloop_step = device_param->kernel_loops;
|
||||
else innerloop_step = 1;
|
||||
|
||||
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT) innerloop_cnt = (u32) straight_ctx->kernel_rules_cnt;
|
||||
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT) innerloop_cnt = straight_ctx->kernel_rules_cnt;
|
||||
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI) innerloop_cnt = (u32) combinator_ctx->combs_cnt;
|
||||
else if (user_options_extra->attack_kern == ATTACK_KERN_BF) innerloop_cnt = (u32) mask_ctx->bfs_cnt;
|
||||
}
|
||||
@ -4133,7 +4137,7 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co
|
||||
device_param->innerloop_pos = innerloop_pos;
|
||||
device_param->innerloop_left = innerloop_left;
|
||||
|
||||
device_param->kernel_params_buf32[30] = (u32) innerloop_left;
|
||||
device_param->kernel_params_buf32[30] = innerloop_left;
|
||||
|
||||
device_param->outerloop_multi = (double) innerloop_cnt / (double) (innerloop_pos + innerloop_left);
|
||||
|
||||
@ -4141,7 +4145,7 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co
|
||||
|
||||
if (hashes->salts_shown[salt_pos] == 1)
|
||||
{
|
||||
status_ctx->words_progress_done[salt_pos] += (u64) pws_cnt * innerloop_left;
|
||||
status_ctx->words_progress_done[salt_pos] += pws_cnt * innerloop_left;
|
||||
|
||||
continue;
|
||||
}
|
||||
@ -4480,7 +4484,7 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co
|
||||
|
||||
if (status_ctx->run_thread_level2 == true)
|
||||
{
|
||||
const u64 perf_sum_all = (u64) pws_cnt * innerloop_left;
|
||||
const u64 perf_sum_all = pws_cnt * innerloop_left;
|
||||
|
||||
const double speed_msec = hc_timer_get (device_param->timer_speed);
|
||||
|
||||
@ -4528,44 +4532,42 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
double total_msec = device_param->speed_msec[0];
|
||||
|
||||
for (u32 speed_pos = 1; speed_pos < device_param->speed_pos; speed_pos++)
|
||||
{
|
||||
total_msec += device_param->speed_msec[speed_pos];
|
||||
}
|
||||
|
||||
if (user_options->slow_candidates == true)
|
||||
{
|
||||
if ((total_msec > 4000) || (device_param->speed_pos == SPEED_CACHE - 1))
|
||||
{
|
||||
const u32 speed_pos = device_param->speed_pos;
|
||||
|
||||
if (speed_pos)
|
||||
{
|
||||
device_param->speed_cnt[0] = device_param->speed_cnt[speed_pos - 1];
|
||||
device_param->speed_msec[0] = device_param->speed_msec[speed_pos - 1];
|
||||
}
|
||||
|
||||
device_param->speed_pos = 0;
|
||||
|
||||
device_param->speed_only_finish = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
double total_msec = device_param->speed_msec[0];
|
||||
// it's unclear if 4s is enough to turn on boost mode for all backend device
|
||||
|
||||
for (u32 speed_pos = 1; speed_pos < device_param->speed_pos; speed_pos++)
|
||||
if ((total_msec > 4000) || (device_param->speed_pos == SPEED_CACHE - 1))
|
||||
{
|
||||
total_msec += device_param->speed_msec[speed_pos];
|
||||
}
|
||||
device_param->speed_only_finish = true;
|
||||
|
||||
if (user_options->slow_candidates == true)
|
||||
{
|
||||
if ((total_msec > 4000) || (device_param->speed_pos == SPEED_CACHE - 1))
|
||||
{
|
||||
const u32 speed_pos = device_param->speed_pos;
|
||||
|
||||
if (speed_pos)
|
||||
{
|
||||
device_param->speed_cnt[0] = device_param->speed_cnt[speed_pos - 1];
|
||||
device_param->speed_msec[0] = device_param->speed_msec[speed_pos - 1];
|
||||
}
|
||||
|
||||
device_param->speed_pos = 0;
|
||||
|
||||
device_param->speed_only_finish = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// it's unclear if 4s is enough to turn on boost mode for all backend device
|
||||
|
||||
if ((total_msec > 4000) || (device_param->speed_pos == SPEED_CACHE - 1))
|
||||
{
|
||||
device_param->speed_only_finish = true;
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6792,7 +6794,7 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
u64 size_plains = (u64) hashes->digests_cnt * sizeof (plain_t);
|
||||
u64 size_salts = (u64) hashes->salts_cnt * sizeof (salt_t);
|
||||
u64 size_esalts = (u64) hashes->digests_cnt * (u64) hashconfig->esalt_size;
|
||||
u64 size_esalts = (u64) hashes->digests_cnt * hashconfig->esalt_size;
|
||||
u64 size_shown = (u64) hashes->digests_cnt * sizeof (u32);
|
||||
u64 size_digests = (u64) hashes->digests_cnt * (u64) hashconfig->dgst_size;
|
||||
|
||||
@ -6838,7 +6840,7 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
// kern type
|
||||
|
||||
u32 kern_type = (u32) hashconfig->kern_type;
|
||||
u32 kern_type = hashconfig->kern_type;
|
||||
|
||||
if (module_ctx->module_kern_type_dynamic != MODULE_DEFAULT)
|
||||
{
|
||||
@ -7671,10 +7673,10 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
if (user_options->benchmark == true)
|
||||
{
|
||||
((u32 *) hashes->digests_buf)[0] = -1u;
|
||||
((u32 *) hashes->digests_buf)[1] = -1u;
|
||||
((u32 *) hashes->digests_buf)[2] = -1u;
|
||||
((u32 *) hashes->digests_buf)[3] = -1u;
|
||||
((u32 *) hashes->digests_buf)[0] = -1U;
|
||||
((u32 *) hashes->digests_buf)[1] = -1U;
|
||||
((u32 *) hashes->digests_buf)[2] = -1U;
|
||||
((u32 *) hashes->digests_buf)[3] = -1U;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -9271,12 +9273,12 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
// this value should represent a reasonable amount of memory a host system has per GPU.
|
||||
// note we're allocating 3 blocks of that size.
|
||||
|
||||
const u64 PWS_SPACE = 1024ull * 1024ull * 1024ull;
|
||||
const u64 PWS_SPACE = 1024ULL * 1024ULL * 1024ULL;
|
||||
|
||||
// sometimes device_available_mem and device_maxmem_alloc reported back from the opencl runtime are a bit inaccurate.
|
||||
// let's add some extra space just to be sure.
|
||||
|
||||
const u64 EXTRA_SPACE = 64ull * 1024ull * 1024ull;
|
||||
const u64 EXTRA_SPACE = 64ULL * 1024ULL * 1024ULL;
|
||||
|
||||
while (kernel_accel_max >= kernel_accel_min)
|
||||
{
|
||||
@ -9284,13 +9286,13 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
// size_pws
|
||||
|
||||
size_pws = (u64) kernel_power_max * sizeof (pw_t);
|
||||
size_pws = kernel_power_max * sizeof (pw_t);
|
||||
|
||||
size_pws_amp = (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL) ? 1 : size_pws;
|
||||
|
||||
// size_pws_comp
|
||||
|
||||
size_pws_comp = (u64) kernel_power_max * (sizeof (u32) * 64);
|
||||
size_pws_comp = kernel_power_max * (sizeof (u32) * 64);
|
||||
|
||||
// size_pws_idx
|
||||
|
||||
@ -9298,28 +9300,28 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
// size_tmps
|
||||
|
||||
size_tmps = (u64) kernel_power_max * (hashconfig->tmp_size + hashconfig->extra_tmp_size);
|
||||
size_tmps = kernel_power_max * (hashconfig->tmp_size + hashconfig->extra_tmp_size);
|
||||
|
||||
// size_hooks
|
||||
|
||||
size_hooks = (u64) kernel_power_max * hashconfig->hook_size;
|
||||
size_hooks = kernel_power_max * hashconfig->hook_size;
|
||||
|
||||
#ifdef WITH_BRAIN
|
||||
// size_brains
|
||||
|
||||
size_brain_link_in = (u64) kernel_power_max * 1;
|
||||
size_brain_link_out = (u64) kernel_power_max * 8;
|
||||
size_brain_link_in = kernel_power_max * 1;
|
||||
size_brain_link_out = kernel_power_max * 8;
|
||||
#endif
|
||||
|
||||
if (user_options->slow_candidates == true)
|
||||
{
|
||||
// size_pws_pre
|
||||
|
||||
size_pws_pre = (u64) kernel_power_max * sizeof (pw_pre_t);
|
||||
size_pws_pre = kernel_power_max * sizeof (pw_pre_t);
|
||||
|
||||
// size_pws_base
|
||||
|
||||
size_pws_base = (u64) kernel_power_max * sizeof (pw_pre_t);
|
||||
size_pws_base = kernel_power_max * sizeof (pw_pre_t);
|
||||
}
|
||||
|
||||
// now check if all device-memory sizes which depend on the kernel_accel_max amplifier are within its boundaries
|
||||
|
@ -57,28 +57,26 @@ int benchmark_next (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
return hash_mode;
|
||||
}
|
||||
else
|
||||
|
||||
char *modulefile = (char *) hcmalloc (HCBUFSIZ_TINY);
|
||||
|
||||
for (int i = cur; i < MODULE_HASH_MODES_MAXIMUM; i++)
|
||||
{
|
||||
char *modulefile = (char *) hcmalloc (HCBUFSIZ_TINY);
|
||||
module_filename (folder_config, i, modulefile, HCBUFSIZ_TINY);
|
||||
|
||||
for (int i = cur; i < MODULE_HASH_MODES_MAXIMUM; i++)
|
||||
if (hc_path_exist (modulefile) == true)
|
||||
{
|
||||
module_filename (folder_config, i, modulefile, HCBUFSIZ_TINY);
|
||||
const int hash_mode = i;
|
||||
|
||||
if (hc_path_exist (modulefile) == true)
|
||||
{
|
||||
const int hash_mode = i;
|
||||
cur = hash_mode + 1;
|
||||
|
||||
cur = hash_mode + 1;
|
||||
hcfree (modulefile);
|
||||
|
||||
hcfree (modulefile);
|
||||
|
||||
return hash_mode;
|
||||
}
|
||||
return hash_mode;
|
||||
}
|
||||
|
||||
hcfree (modulefile);
|
||||
}
|
||||
|
||||
hcfree (modulefile);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
36
src/bitmap.c
36
src/bitmap.c
@ -13,10 +13,10 @@ static void selftest_to_bitmap (const u32 dgst_shifts, char *digests_buf_ptr, co
|
||||
{
|
||||
u32 *digest_ptr = (u32 *) digests_buf_ptr;
|
||||
|
||||
const u32 val0 = 1u << (digest_ptr[dgst_pos0] & 0x1f);
|
||||
const u32 val1 = 1u << (digest_ptr[dgst_pos1] & 0x1f);
|
||||
const u32 val2 = 1u << (digest_ptr[dgst_pos2] & 0x1f);
|
||||
const u32 val3 = 1u << (digest_ptr[dgst_pos3] & 0x1f);
|
||||
const u32 val0 = 1U << (digest_ptr[dgst_pos0] & 0x1f);
|
||||
const u32 val1 = 1U << (digest_ptr[dgst_pos1] & 0x1f);
|
||||
const u32 val2 = 1U << (digest_ptr[dgst_pos2] & 0x1f);
|
||||
const u32 val3 = 1U << (digest_ptr[dgst_pos3] & 0x1f);
|
||||
|
||||
const u32 idx0 = (digest_ptr[dgst_pos0] >> dgst_shifts) & bitmap_mask;
|
||||
const u32 idx1 = (digest_ptr[dgst_pos1] >> dgst_shifts) & bitmap_mask;
|
||||
@ -44,10 +44,10 @@ static bool generate_bitmaps (const u32 digests_cnt, const u32 dgst_size, const
|
||||
|
||||
digests_buf_ptr += dgst_size;
|
||||
|
||||
const u32 val0 = 1u << (digest_ptr[dgst_pos0] & 0x1f);
|
||||
const u32 val1 = 1u << (digest_ptr[dgst_pos1] & 0x1f);
|
||||
const u32 val2 = 1u << (digest_ptr[dgst_pos2] & 0x1f);
|
||||
const u32 val3 = 1u << (digest_ptr[dgst_pos3] & 0x1f);
|
||||
const u32 val0 = 1U << (digest_ptr[dgst_pos0] & 0x1f);
|
||||
const u32 val1 = 1U << (digest_ptr[dgst_pos1] & 0x1f);
|
||||
const u32 val2 = 1U << (digest_ptr[dgst_pos2] & 0x1f);
|
||||
const u32 val3 = 1U << (digest_ptr[dgst_pos3] & 0x1f);
|
||||
|
||||
const u32 idx0 = (digest_ptr[dgst_pos0] >> dgst_shifts) & bitmap_mask;
|
||||
const u32 idx1 = (digest_ptr[dgst_pos1] >> dgst_shifts) & bitmap_mask;
|
||||
@ -99,14 +99,14 @@ int bitmap_ctx_init (hashcat_ctx_t *hashcat_ctx)
|
||||
const u32 bitmap_min = user_options->bitmap_min;
|
||||
const u32 bitmap_max = user_options->bitmap_max;
|
||||
|
||||
u32 *bitmap_s1_a = (u32 *) hcmalloc ((1u << bitmap_max) * sizeof (u32));
|
||||
u32 *bitmap_s1_b = (u32 *) hcmalloc ((1u << bitmap_max) * sizeof (u32));
|
||||
u32 *bitmap_s1_c = (u32 *) hcmalloc ((1u << bitmap_max) * sizeof (u32));
|
||||
u32 *bitmap_s1_d = (u32 *) hcmalloc ((1u << bitmap_max) * sizeof (u32));
|
||||
u32 *bitmap_s2_a = (u32 *) hcmalloc ((1u << bitmap_max) * sizeof (u32));
|
||||
u32 *bitmap_s2_b = (u32 *) hcmalloc ((1u << bitmap_max) * sizeof (u32));
|
||||
u32 *bitmap_s2_c = (u32 *) hcmalloc ((1u << bitmap_max) * sizeof (u32));
|
||||
u32 *bitmap_s2_d = (u32 *) hcmalloc ((1u << bitmap_max) * sizeof (u32));
|
||||
u32 *bitmap_s1_a = (u32 *) hcmalloc ((1U << bitmap_max) * sizeof (u32));
|
||||
u32 *bitmap_s1_b = (u32 *) hcmalloc ((1U << bitmap_max) * sizeof (u32));
|
||||
u32 *bitmap_s1_c = (u32 *) hcmalloc ((1U << bitmap_max) * sizeof (u32));
|
||||
u32 *bitmap_s1_d = (u32 *) hcmalloc ((1U << bitmap_max) * sizeof (u32));
|
||||
u32 *bitmap_s2_a = (u32 *) hcmalloc ((1U << bitmap_max) * sizeof (u32));
|
||||
u32 *bitmap_s2_b = (u32 *) hcmalloc ((1U << bitmap_max) * sizeof (u32));
|
||||
u32 *bitmap_s2_c = (u32 *) hcmalloc ((1U << bitmap_max) * sizeof (u32));
|
||||
u32 *bitmap_s2_d = (u32 *) hcmalloc ((1U << bitmap_max) * sizeof (u32));
|
||||
|
||||
u32 bitmap_bits;
|
||||
u32 bitmap_nums;
|
||||
@ -115,7 +115,7 @@ int bitmap_ctx_init (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
for (bitmap_bits = bitmap_min; bitmap_bits < bitmap_max; bitmap_bits++)
|
||||
{
|
||||
bitmap_nums = 1u << bitmap_bits;
|
||||
bitmap_nums = 1U << bitmap_bits;
|
||||
|
||||
bitmap_mask = bitmap_nums - 1;
|
||||
|
||||
@ -134,7 +134,7 @@ int bitmap_ctx_init (hashcat_ctx_t *hashcat_ctx)
|
||||
EVENT_DATA (EVENT_BITMAP_FINAL_OVERFLOW, NULL, 0);
|
||||
}
|
||||
|
||||
bitmap_nums = 1u << bitmap_bits;
|
||||
bitmap_nums = 1U << bitmap_bits;
|
||||
|
||||
bitmap_mask = bitmap_nums - 1;
|
||||
|
||||
|
146
src/brain.c
146
src/brain.c
@ -934,7 +934,7 @@ bool brain_client_connect (hc_device_param_t *device_param, const status_ctx_t *
|
||||
|
||||
snprintf (port_str, sizeof (port_str), "%i", port);
|
||||
|
||||
const char *host_real = (host == NULL) ? "127.0.0.1" : (const char *) host;
|
||||
const char *host_real = (host == NULL) ? "127.0.0.1" : host;
|
||||
|
||||
bool connected = false;
|
||||
|
||||
@ -1589,36 +1589,34 @@ bool brain_server_read_hash_dump (brain_server_db_hash_t *brain_server_db_hash,
|
||||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
||||
i64 temp_cnt = (u64) sb.st_size / sizeof (brain_server_hash_long_t);
|
||||
|
||||
if (brain_server_db_hash_realloc (brain_server_db_hash, temp_cnt) == false)
|
||||
{
|
||||
i64 temp_cnt = (u64) sb.st_size / sizeof (brain_server_hash_long_t);
|
||||
|
||||
if (brain_server_db_hash_realloc (brain_server_db_hash, temp_cnt) == false)
|
||||
{
|
||||
brain_logging (stderr, 0, "%s\n", MSG_ENOMEM);
|
||||
|
||||
hc_fclose (&fp);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
const size_t nread = hc_fread (brain_server_db_hash->long_buf, sizeof (brain_server_hash_long_t), temp_cnt, &fp);
|
||||
|
||||
if (nread != (size_t) temp_cnt)
|
||||
{
|
||||
brain_logging (stderr, 0, "%s: only %" PRIu64 " bytes read\n", file, (u64) nread * sizeof (brain_server_hash_long_t));
|
||||
|
||||
hc_fclose (&fp);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
brain_server_db_hash->long_cnt = temp_cnt;
|
||||
brain_server_db_hash->write_hashes = false;
|
||||
brain_logging (stderr, 0, "%s\n", MSG_ENOMEM);
|
||||
|
||||
hc_fclose (&fp);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
const size_t nread = hc_fread (brain_server_db_hash->long_buf, sizeof (brain_server_hash_long_t), temp_cnt, &fp);
|
||||
|
||||
if (nread != (size_t) temp_cnt)
|
||||
{
|
||||
brain_logging (stderr, 0, "%s: only %" PRIu64 " bytes read\n", file, (u64) nread * sizeof (brain_server_hash_long_t));
|
||||
|
||||
hc_fclose (&fp);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
brain_server_db_hash->long_cnt = temp_cnt;
|
||||
brain_server_db_hash->write_hashes = false;
|
||||
|
||||
hc_fclose (&fp);
|
||||
|
||||
const double ms = hc_timer_get (timer_dump);
|
||||
|
||||
brain_logging (stdout, 0, "Read %" PRIu64 " bytes from session 0x%08x in %.2f ms\n", (u64) sb.st_size, brain_server_db_hash->brain_session, ms);
|
||||
@ -1644,24 +1642,22 @@ bool brain_server_write_hash_dump (brain_server_db_hash_t *brain_server_db_hash,
|
||||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
||||
const size_t nwrite = hc_fwrite (brain_server_db_hash->long_buf, sizeof (brain_server_hash_long_t), brain_server_db_hash->long_cnt, &fp);
|
||||
|
||||
if (nwrite != (size_t) brain_server_db_hash->long_cnt)
|
||||
{
|
||||
const size_t nwrite = hc_fwrite (brain_server_db_hash->long_buf, sizeof (brain_server_hash_long_t), brain_server_db_hash->long_cnt, &fp);
|
||||
|
||||
if (nwrite != (size_t) brain_server_db_hash->long_cnt)
|
||||
{
|
||||
brain_logging (stderr, 0, "%s: only %" PRIu64 " bytes written\n", file, (u64) nwrite * sizeof (brain_server_hash_long_t));
|
||||
|
||||
hc_fclose (&fp);
|
||||
|
||||
return false;
|
||||
}
|
||||
brain_logging (stderr, 0, "%s: only %" PRIu64 " bytes written\n", file, (u64) nwrite * sizeof (brain_server_hash_long_t));
|
||||
|
||||
hc_fclose (&fp);
|
||||
|
||||
brain_server_db_hash->write_hashes = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
hc_fclose (&fp);
|
||||
|
||||
brain_server_db_hash->write_hashes = false;
|
||||
|
||||
// stats
|
||||
|
||||
const double ms = hc_timer_get (timer_dump);
|
||||
@ -1790,36 +1786,34 @@ bool brain_server_read_attack_dump (brain_server_db_attack_t *brain_server_db_at
|
||||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
||||
i64 temp_cnt = (u64) sb.st_size / sizeof (brain_server_attack_long_t);
|
||||
|
||||
if (brain_server_db_attack_realloc (brain_server_db_attack, temp_cnt, 0) == false)
|
||||
{
|
||||
i64 temp_cnt = (u64) sb.st_size / sizeof (brain_server_attack_long_t);
|
||||
|
||||
if (brain_server_db_attack_realloc (brain_server_db_attack, temp_cnt, 0) == false)
|
||||
{
|
||||
brain_logging (stderr, 0, "%s\n", MSG_ENOMEM);
|
||||
|
||||
hc_fclose (&fp);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
const size_t nread = hc_fread (brain_server_db_attack->long_buf, sizeof (brain_server_attack_long_t), temp_cnt, &fp);
|
||||
|
||||
if (nread != (size_t) temp_cnt)
|
||||
{
|
||||
brain_logging (stderr, 0, "%s: only %" PRIu64 " bytes read\n", file, (u64) nread * sizeof (brain_server_attack_long_t));
|
||||
|
||||
hc_fclose (&fp);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
brain_server_db_attack->long_cnt = temp_cnt;
|
||||
brain_server_db_attack->write_attacks = false;
|
||||
brain_logging (stderr, 0, "%s\n", MSG_ENOMEM);
|
||||
|
||||
hc_fclose (&fp);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
const size_t nread = hc_fread (brain_server_db_attack->long_buf, sizeof (brain_server_attack_long_t), temp_cnt, &fp);
|
||||
|
||||
if (nread != (size_t) temp_cnt)
|
||||
{
|
||||
brain_logging (stderr, 0, "%s: only %" PRIu64 " bytes read\n", file, (u64) nread * sizeof (brain_server_attack_long_t));
|
||||
|
||||
hc_fclose (&fp);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
brain_server_db_attack->long_cnt = temp_cnt;
|
||||
brain_server_db_attack->write_attacks = false;
|
||||
|
||||
hc_fclose (&fp);
|
||||
|
||||
const double ms = hc_timer_get (timer_dump);
|
||||
|
||||
brain_logging (stdout, 0, "Read %" PRIu64 " bytes from attack 0x%08x in %.2f ms\n", (u64) sb.st_size, brain_server_db_attack->brain_attack, ms);
|
||||
@ -1845,26 +1839,24 @@ bool brain_server_write_attack_dump (brain_server_db_attack_t *brain_server_db_a
|
||||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
||||
// storing should not include reserved attacks only finished
|
||||
|
||||
const size_t nwrite = hc_fwrite (brain_server_db_attack->long_buf, sizeof (brain_server_attack_long_t), brain_server_db_attack->long_cnt, &fp);
|
||||
|
||||
if (nwrite != (size_t) brain_server_db_attack->long_cnt)
|
||||
{
|
||||
// storing should not include reserved attacks only finished
|
||||
|
||||
const size_t nwrite = hc_fwrite (brain_server_db_attack->long_buf, sizeof (brain_server_attack_long_t), brain_server_db_attack->long_cnt, &fp);
|
||||
|
||||
if (nwrite != (size_t) brain_server_db_attack->long_cnt)
|
||||
{
|
||||
brain_logging (stderr, 0, "%s: only %" PRIu64 " bytes written\n", file, (u64) nwrite * sizeof (brain_server_attack_long_t));
|
||||
|
||||
hc_fclose (&fp);
|
||||
|
||||
return false;
|
||||
}
|
||||
brain_logging (stderr, 0, "%s: only %" PRIu64 " bytes written\n", file, (u64) nwrite * sizeof (brain_server_attack_long_t));
|
||||
|
||||
hc_fclose (&fp);
|
||||
|
||||
brain_server_db_attack->write_attacks = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
hc_fclose (&fp);
|
||||
|
||||
brain_server_db_attack->write_attacks = false;
|
||||
|
||||
// stats
|
||||
|
||||
const double ms = hc_timer_get (timer_dump);
|
||||
|
@ -78,7 +78,7 @@ static const u32 crc32tab[256] =
|
||||
|
||||
u32 cpu_crc32_buffer (const u8 *buf, const size_t length)
|
||||
{
|
||||
u32 crc = ~0u;
|
||||
u32 crc = ~0U;
|
||||
|
||||
for (size_t pos = 0; pos < length; pos++)
|
||||
{
|
||||
@ -90,7 +90,7 @@ u32 cpu_crc32_buffer (const u8 *buf, const size_t length)
|
||||
|
||||
int cpu_crc32 (const char *filename, u8 keytab[64])
|
||||
{
|
||||
u32 crc = ~0u;
|
||||
u32 crc = ~0U;
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
|
@ -541,7 +541,7 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
|
||||
|
||||
brain_client_generate_hash ((u64 *) hash, (const char *) extra_info_straight.out_buf, extra_info_straight.out_len);
|
||||
|
||||
u32 *ptr = (u32 *) device_param->brain_link_out_buf;
|
||||
u32 *ptr = device_param->brain_link_out_buf;
|
||||
|
||||
ptr[(device_param->pws_pre_cnt * 2) + 0] = hash[0];
|
||||
ptr[(device_param->pws_pre_cnt * 2) + 1] = hash[1];
|
||||
@ -853,7 +853,7 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
|
||||
|
||||
brain_client_generate_hash ((u64 *) hash, (const char *) extra_info_combi.out_buf, extra_info_combi.out_len);
|
||||
|
||||
u32 *ptr = (u32 *) device_param->brain_link_out_buf;
|
||||
u32 *ptr = device_param->brain_link_out_buf;
|
||||
|
||||
ptr[(device_param->pws_pre_cnt * 2) + 0] = hash[0];
|
||||
ptr[(device_param->pws_pre_cnt * 2) + 1] = hash[1];
|
||||
@ -1108,7 +1108,7 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
|
||||
|
||||
brain_client_generate_hash ((u64 *) hash, (const char *) extra_info_mask.out_buf, extra_info_mask.out_len);
|
||||
|
||||
u32 *ptr = (u32 *) device_param->brain_link_out_buf;
|
||||
u32 *ptr = device_param->brain_link_out_buf;
|
||||
|
||||
ptr[(device_param->pws_pre_cnt * 2) + 0] = hash[0];
|
||||
ptr[(device_param->pws_pre_cnt * 2) + 1] = hash[1];
|
||||
@ -1362,7 +1362,7 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
|
||||
{
|
||||
u64 words_off = 0;
|
||||
u64 words_fin = 0;
|
||||
u64 words_extra = -1u;
|
||||
u64 words_extra = -1U;
|
||||
u64 words_extra_total = 0;
|
||||
|
||||
memset (device_param->pws_comp, 0, device_param->size_pws_comp);
|
||||
|
@ -168,7 +168,7 @@ int hc_fseek (HCFILE *fp, off_t offset, int whence)
|
||||
|
||||
if (fp->is_gzip)
|
||||
{
|
||||
r = gzseek (fp->gfp, (z_off_t) offset, whence);
|
||||
r = gzseek (fp->gfp, offset, whence);
|
||||
}
|
||||
else if (fp->is_zip)
|
||||
{
|
||||
@ -371,7 +371,7 @@ int hc_fscanf (HCFILE *fp, const char *format, void *ptr)
|
||||
return -1;
|
||||
}
|
||||
|
||||
sscanf (b, format, (void *) ptr);
|
||||
sscanf (b, format, ptr);
|
||||
|
||||
hcfree (buf);
|
||||
|
||||
|
@ -773,7 +773,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
if ((user_options->username == true) || (hashconfig->opts_type & OPTS_TYPE_HASH_COPY) || (hashconfig->opts_type & OPTS_TYPE_HASH_SPLIT))
|
||||
{
|
||||
u32 hash_pos;
|
||||
u64 hash_pos;
|
||||
|
||||
for (hash_pos = 0; hash_pos < hashes_avail; hash_pos++)
|
||||
{
|
||||
@ -820,7 +820,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
|
||||
salts_buf = (salt_t *) hccalloc (1, sizeof (salt_t));
|
||||
}
|
||||
|
||||
for (u32 hash_pos = 0; hash_pos < hashes_avail; hash_pos++)
|
||||
for (u64 hash_pos = 0; hash_pos < hashes_avail; hash_pos++)
|
||||
{
|
||||
hashes_buf[hash_pos].digest = ((char *) digests_buf) + (hash_pos * hashconfig->dgst_size);
|
||||
|
||||
|
18
src/hwmon.c
18
src/hwmon.c
@ -176,7 +176,7 @@ static int hm_SYSFS_get_fan_speed_current (hashcat_ctx_t *hashcat_ctx, const int
|
||||
return -1;
|
||||
}
|
||||
|
||||
const float p1 = (float) pwm1_max / 100.0f;
|
||||
const float p1 = (float) pwm1_max / 100.0F;
|
||||
|
||||
const float pwm1_percent = (float) pwm1_cur / p1;
|
||||
|
||||
@ -821,14 +821,14 @@ static int nvapi_init (hashcat_ctx_t *hashcat_ctx)
|
||||
}
|
||||
|
||||
HC_LOAD_FUNC(nvapi, nvapi_QueryInterface, NVAPI_QUERYINTERFACE, NVAPI, 0)
|
||||
HC_LOAD_ADDR(nvapi, NvAPI_Initialize, NVAPI_INITIALIZE, nvapi_QueryInterface, 0x0150E828u, NVAPI, 0)
|
||||
HC_LOAD_ADDR(nvapi, NvAPI_Unload, NVAPI_UNLOAD, nvapi_QueryInterface, 0xD22BDD7Eu, NVAPI, 0)
|
||||
HC_LOAD_ADDR(nvapi, NvAPI_GetErrorMessage, NVAPI_GETERRORMESSAGE, nvapi_QueryInterface, 0x6C2D048Cu, NVAPI, 0)
|
||||
HC_LOAD_ADDR(nvapi, NvAPI_EnumPhysicalGPUs, NVAPI_ENUMPHYSICALGPUS, nvapi_QueryInterface, 0xE5AC921Fu, NVAPI, 0)
|
||||
HC_LOAD_ADDR(nvapi, NvAPI_GPU_GetPerfPoliciesInfo, NVAPI_GPU_GETPERFPOLICIESINFO, nvapi_QueryInterface, 0x409D9841u, NVAPI, 0)
|
||||
HC_LOAD_ADDR(nvapi, NvAPI_GPU_GetPerfPoliciesStatus, NVAPI_GPU_GETPERFPOLICIESSTATUS, nvapi_QueryInterface, 0x3D358A0Cu, NVAPI, 0)
|
||||
HC_LOAD_ADDR(nvapi, NvAPI_GPU_GetBusId, NVAPI_GPU_GETBUSID, nvapi_QueryInterface, 0x1BE0B8E5u, NVAPI, 0)
|
||||
HC_LOAD_ADDR(nvapi, NvAPI_GPU_GetBusSlotId, NVAPI_GPU_GETBUSSLOTID, nvapi_QueryInterface, 0x2A0A350Fu, NVAPI, 0)
|
||||
HC_LOAD_ADDR(nvapi, NvAPI_Initialize, NVAPI_INITIALIZE, nvapi_QueryInterface, 0x0150E828U, NVAPI, 0)
|
||||
HC_LOAD_ADDR(nvapi, NvAPI_Unload, NVAPI_UNLOAD, nvapi_QueryInterface, 0xD22BDD7EU, NVAPI, 0)
|
||||
HC_LOAD_ADDR(nvapi, NvAPI_GetErrorMessage, NVAPI_GETERRORMESSAGE, nvapi_QueryInterface, 0x6C2D048CU, NVAPI, 0)
|
||||
HC_LOAD_ADDR(nvapi, NvAPI_EnumPhysicalGPUs, NVAPI_ENUMPHYSICALGPUS, nvapi_QueryInterface, 0xE5AC921FU, NVAPI, 0)
|
||||
HC_LOAD_ADDR(nvapi, NvAPI_GPU_GetPerfPoliciesInfo, NVAPI_GPU_GETPERFPOLICIESINFO, nvapi_QueryInterface, 0x409D9841U, NVAPI, 0)
|
||||
HC_LOAD_ADDR(nvapi, NvAPI_GPU_GetPerfPoliciesStatus, NVAPI_GPU_GETPERFPOLICIESSTATUS, nvapi_QueryInterface, 0x3D358A0CU, NVAPI, 0)
|
||||
HC_LOAD_ADDR(nvapi, NvAPI_GPU_GetBusId, NVAPI_GPU_GETBUSID, nvapi_QueryInterface, 0x1BE0B8E5U, NVAPI, 0)
|
||||
HC_LOAD_ADDR(nvapi, NvAPI_GPU_GetBusSlotId, NVAPI_GPU_GETBUSSLOTID, nvapi_QueryInterface, 0x2A0A350FU, NVAPI, 0)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
|
||||
// check for missing pointer assignements
|
||||
|
||||
#define CHECK_DEFINED(func) \
|
||||
if (func == NULL) \
|
||||
if ((func) == NULL) \
|
||||
{ \
|
||||
event_log_error (hashcat_ctx, "Missing symbol definitions. Old template?"); \
|
||||
\
|
||||
@ -211,7 +211,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
|
||||
// mandatory functions check
|
||||
|
||||
#define CHECK_MANDATORY(func) \
|
||||
if (func == MODULE_DEFAULT) \
|
||||
if ((func) == MODULE_DEFAULT) \
|
||||
{ \
|
||||
event_log_error (hashcat_ctx, "Missing mandatory symbol definitions"); \
|
||||
\
|
||||
|
@ -476,7 +476,7 @@ static void main_outerloop_mainscreen (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx,
|
||||
|
||||
for (u32 i = 0; i < 32; i++)
|
||||
{
|
||||
const u32 opti_bit = 1u << i;
|
||||
const u32 opti_bit = 1U << i;
|
||||
|
||||
if (hashconfig->opti_type & opti_bit) event_log_info (hashcat_ctx, "* %s", stroptitype (opti_bit));
|
||||
}
|
||||
|
@ -365,8 +365,8 @@ static int mp_gen_css (hashcat_ctx_t *hashcat_ctx, char *mask_buf, size_t mask_l
|
||||
{
|
||||
const user_options_t *user_options = hashcat_ctx->user_options;
|
||||
|
||||
u32 mask_pos;
|
||||
u32 css_pos;
|
||||
size_t mask_pos;
|
||||
size_t css_pos;
|
||||
|
||||
for (mask_pos = 0, css_pos = 0; mask_pos < mask_len; mask_pos++, css_pos++)
|
||||
{
|
||||
|
@ -69,7 +69,7 @@ int sort_pot_tree_by_hash (const void *v1, const void *v2)
|
||||
const hash_t *h1 = (const hash_t *) t1->nodes->hash_buf;
|
||||
const hash_t *h2 = (const hash_t *) t2->nodes->hash_buf;
|
||||
|
||||
hashconfig_t *hc = (hashconfig_t *) t1->hashconfig; // is same as t2->hashconfig
|
||||
hashconfig_t *hc = t1->hashconfig; // is same as t2->hashconfig
|
||||
|
||||
return sort_by_hash (h1, h2, hc);
|
||||
}
|
||||
@ -576,12 +576,10 @@ int potfile_remove_parse (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
// should be rejected?
|
||||
//const int parser_status = module_ctx->module_hash_decode_potfile (hashconfig, hash_buf.digest, hash_buf.salt, hash_buf.esalt, hash_buf.hook_salt, hash_buf.hash_info, line_hash_buf, line_hash_len, NULL);
|
||||
//if (parser_status != PARSER_OK) continue;
|
||||
}
|
||||
|
||||
// should be rejected?
|
||||
//const int parser_status = module_ctx->module_hash_decode_potfile (hashconfig, hash_buf.digest, hash_buf.salt, hash_buf.esalt, hash_buf.hook_salt, hash_buf.hash_info, line_hash_buf, line_hash_len, NULL);
|
||||
//if (parser_status != PARSER_OK) continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
10
src/shared.c
10
src/shared.c
@ -336,7 +336,11 @@ bool hc_path_create (const char *path)
|
||||
{
|
||||
if (hc_path_exist (path) == true) return false;
|
||||
|
||||
const int fd = creat (path, S_IRUSR | S_IWUSR);
|
||||
#ifdef O_CLOEXEC
|
||||
const int fd = open (path, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, S_IRUSR | S_IWUSR);
|
||||
#else
|
||||
const int fd = open (path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
|
||||
#endif
|
||||
|
||||
if (fd == -1) return false;
|
||||
|
||||
@ -790,7 +794,7 @@ float get_entropy (const u8 *buf, const int len)
|
||||
|
||||
float w = (float) r / len;
|
||||
|
||||
entropy += -w * log2 (w);
|
||||
entropy += -w * log2f (w);
|
||||
}
|
||||
|
||||
return entropy;
|
||||
@ -1143,7 +1147,7 @@ bool generic_salt_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, const u8
|
||||
if (in_len < (int) (((hashconfig->salt_min * 8) / 6) + 0)) return false;
|
||||
if (in_len > (int) (((hashconfig->salt_max * 8) / 6) + 3)) return false;
|
||||
|
||||
tmp_len = base64_decode (base64_to_int, (const u8 *) in_buf, in_len, tmp_u8);
|
||||
tmp_len = base64_decode (base64_to_int, in_buf, in_len, tmp_u8);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
155
src/status.c
155
src/status.c
@ -327,34 +327,28 @@ char *status_get_hash_target (const hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
return tmp_buf2;
|
||||
}
|
||||
else
|
||||
|
||||
if (hashconfig->opts_type & OPTS_TYPE_BINARY_HASHFILE)
|
||||
{
|
||||
if (hashconfig->opts_type & OPTS_TYPE_BINARY_HASHFILE)
|
||||
{
|
||||
return hcstrdup (hashes->hashfile);
|
||||
}
|
||||
else
|
||||
{
|
||||
char *tmp_buf = (char *) hcmalloc (HCBUFSIZ_LARGE);
|
||||
|
||||
const int tmp_len = hash_encode (hashcat_ctx->hashconfig, hashcat_ctx->hashes, hashcat_ctx->module_ctx, tmp_buf, HCBUFSIZ_LARGE, 0, 0);
|
||||
|
||||
tmp_buf[tmp_len] = 0;
|
||||
|
||||
compress_terminal_line_length (tmp_buf, 19, 6); // 19 = strlen ("Hash.Target......: ")
|
||||
|
||||
char *tmp_buf2 = strdup (tmp_buf);
|
||||
|
||||
free (tmp_buf);
|
||||
|
||||
return tmp_buf2;
|
||||
}
|
||||
return hcstrdup (hashes->hashfile);
|
||||
}
|
||||
|
||||
char *tmp_buf = (char *) hcmalloc (HCBUFSIZ_LARGE);
|
||||
|
||||
const int tmp_len = hash_encode (hashcat_ctx->hashconfig, hashcat_ctx->hashes, hashcat_ctx->module_ctx, tmp_buf, HCBUFSIZ_LARGE, 0, 0);
|
||||
|
||||
tmp_buf[tmp_len] = 0;
|
||||
|
||||
compress_terminal_line_length (tmp_buf, 19, 6); // 19 = strlen ("Hash.Target......: ")
|
||||
|
||||
char *tmp_buf2 = strdup (tmp_buf);
|
||||
|
||||
free (tmp_buf);
|
||||
|
||||
return tmp_buf2;
|
||||
}
|
||||
else
|
||||
{
|
||||
return hcstrdup (hashes->hashfile);
|
||||
}
|
||||
|
||||
return hcstrdup (hashes->hashfile);
|
||||
}
|
||||
|
||||
int status_get_guess_mode (const hashcat_ctx_t *hashcat_ctx)
|
||||
@ -389,30 +383,21 @@ int status_get_guess_mode (const hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
return GUESS_MODE_STRAIGHT_FILE_RULES_FILE;
|
||||
}
|
||||
else if (has_rule_gen == true)
|
||||
if (has_rule_gen == true)
|
||||
{
|
||||
return GUESS_MODE_STRAIGHT_FILE_RULES_GEN;
|
||||
}
|
||||
else
|
||||
{
|
||||
return GUESS_MODE_STRAIGHT_FILE;
|
||||
}
|
||||
return GUESS_MODE_STRAIGHT_FILE;
|
||||
}
|
||||
else
|
||||
if (has_rule_file == true)
|
||||
{
|
||||
if (has_rule_file == true)
|
||||
{
|
||||
return GUESS_MODE_STRAIGHT_STDIN_RULES_FILE;
|
||||
}
|
||||
else if (has_rule_gen == true)
|
||||
{
|
||||
return GUESS_MODE_STRAIGHT_STDIN_RULES_GEN;
|
||||
}
|
||||
else
|
||||
{
|
||||
return GUESS_MODE_STRAIGHT_STDIN;
|
||||
}
|
||||
return GUESS_MODE_STRAIGHT_STDIN_RULES_FILE;
|
||||
}
|
||||
if (has_rule_gen == true)
|
||||
{
|
||||
return GUESS_MODE_STRAIGHT_STDIN_RULES_GEN;
|
||||
}
|
||||
return GUESS_MODE_STRAIGHT_STDIN;
|
||||
}
|
||||
|
||||
if (user_options->attack_mode == ATTACK_MODE_COMBI)
|
||||
@ -421,10 +406,7 @@ int status_get_guess_mode (const hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
return GUESS_MODE_COMBINATOR_BASE_LEFT;
|
||||
}
|
||||
else
|
||||
{
|
||||
return GUESS_MODE_COMBINATOR_BASE_RIGHT;
|
||||
}
|
||||
return GUESS_MODE_COMBINATOR_BASE_RIGHT;
|
||||
}
|
||||
|
||||
if (user_options->attack_mode == ATTACK_MODE_BF)
|
||||
@ -433,10 +415,7 @@ int status_get_guess_mode (const hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
return GUESS_MODE_MASK_CS;
|
||||
}
|
||||
else
|
||||
{
|
||||
return GUESS_MODE_MASK;
|
||||
}
|
||||
return GUESS_MODE_MASK;
|
||||
}
|
||||
|
||||
if (user_options->attack_mode == ATTACK_MODE_HYBRID1)
|
||||
@ -445,10 +424,7 @@ int status_get_guess_mode (const hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
return GUESS_MODE_HYBRID1_CS;
|
||||
}
|
||||
else
|
||||
{
|
||||
return GUESS_MODE_HYBRID1;
|
||||
}
|
||||
return GUESS_MODE_HYBRID1;
|
||||
}
|
||||
|
||||
if (user_options->attack_mode == ATTACK_MODE_HYBRID2)
|
||||
@ -457,10 +433,7 @@ int status_get_guess_mode (const hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
return GUESS_MODE_HYBRID2_CS;
|
||||
}
|
||||
else
|
||||
{
|
||||
return GUESS_MODE_HYBRID2;
|
||||
}
|
||||
return GUESS_MODE_HYBRID2;
|
||||
}
|
||||
|
||||
return GUESS_MODE_NONE;
|
||||
@ -490,10 +463,7 @@ char *status_get_guess_base (const hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
return strdup (combinator_ctx->dict1);
|
||||
}
|
||||
else
|
||||
{
|
||||
return strdup (combinator_ctx->dict2);
|
||||
}
|
||||
return strdup (combinator_ctx->dict2);
|
||||
}
|
||||
|
||||
if (user_options->attack_mode == ATTACK_MODE_BF)
|
||||
@ -518,14 +488,11 @@ char *status_get_guess_base (const hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
return strdup (mask_ctx->mask);
|
||||
}
|
||||
else
|
||||
{
|
||||
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
||||
|
||||
return strdup (straight_ctx->dict);
|
||||
}
|
||||
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
||||
|
||||
return strdup (straight_ctx->dict);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -568,12 +535,10 @@ int status_get_guess_base_offset (const hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
return mask_ctx->masks_pos + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
||||
|
||||
return straight_ctx->dicts_pos + 1;
|
||||
}
|
||||
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
||||
|
||||
return straight_ctx->dicts_pos + 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -618,12 +583,10 @@ int status_get_guess_base_count (const hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
return mask_ctx->masks_cnt;
|
||||
}
|
||||
else
|
||||
{
|
||||
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
||||
|
||||
return straight_ctx->dicts_cnt;
|
||||
}
|
||||
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
||||
|
||||
return straight_ctx->dicts_cnt;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -657,10 +620,7 @@ char *status_get_guess_mod (const hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
return strdup (combinator_ctx->dict2);
|
||||
}
|
||||
else
|
||||
{
|
||||
return strdup (combinator_ctx->dict1);
|
||||
}
|
||||
return strdup (combinator_ctx->dict1);
|
||||
}
|
||||
|
||||
if (user_options->attack_mode == ATTACK_MODE_BF)
|
||||
@ -683,12 +643,10 @@ char *status_get_guess_mod (const hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
return strdup (straight_ctx->dict);
|
||||
}
|
||||
else
|
||||
{
|
||||
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
|
||||
|
||||
return strdup (mask_ctx->mask);
|
||||
}
|
||||
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
|
||||
|
||||
return strdup (mask_ctx->mask);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@ -729,12 +687,10 @@ int status_get_guess_mod_offset (const hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
return straight_ctx->dicts_pos + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
|
||||
|
||||
return mask_ctx->masks_pos + 1;
|
||||
}
|
||||
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
|
||||
|
||||
return mask_ctx->masks_pos + 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -775,12 +731,10 @@ int status_get_guess_mod_count (const hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
return straight_ctx->dicts_cnt;
|
||||
}
|
||||
else
|
||||
{
|
||||
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
|
||||
|
||||
return mask_ctx->masks_cnt;
|
||||
}
|
||||
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
|
||||
|
||||
return mask_ctx->masks_cnt;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -1196,10 +1150,7 @@ int status_get_progress_mode (const hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
return PROGRESS_MODE_KEYSPACE_KNOWN;
|
||||
}
|
||||
else
|
||||
{
|
||||
return PROGRESS_MODE_KEYSPACE_UNKNOWN;
|
||||
}
|
||||
return PROGRESS_MODE_KEYSPACE_UNKNOWN;
|
||||
}
|
||||
|
||||
double status_get_progress_finished_percent (const hashcat_ctx_t *hashcat_ctx)
|
||||
|
@ -1909,28 +1909,26 @@ u64 user_options_extra_amplifier (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
|
||||
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT)
|
||||
{
|
||||
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT)
|
||||
if (straight_ctx->kernel_rules_cnt)
|
||||
{
|
||||
if (straight_ctx->kernel_rules_cnt)
|
||||
{
|
||||
return straight_ctx->kernel_rules_cnt;
|
||||
}
|
||||
return straight_ctx->kernel_rules_cnt;
|
||||
}
|
||||
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI)
|
||||
}
|
||||
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI)
|
||||
{
|
||||
if (combinator_ctx->combs_cnt)
|
||||
{
|
||||
if (combinator_ctx->combs_cnt)
|
||||
{
|
||||
return combinator_ctx->combs_cnt;
|
||||
}
|
||||
return combinator_ctx->combs_cnt;
|
||||
}
|
||||
else if (user_options_extra->attack_kern == ATTACK_KERN_BF)
|
||||
}
|
||||
else if (user_options_extra->attack_kern == ATTACK_KERN_BF)
|
||||
{
|
||||
if (mask_ctx->bfs_cnt)
|
||||
{
|
||||
if (mask_ctx->bfs_cnt)
|
||||
{
|
||||
return mask_ctx->bfs_cnt;
|
||||
}
|
||||
return mask_ctx->bfs_cnt;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user