|
|
|
@ -104,20 +104,103 @@ int process_stdout (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
|
|
|
|
|
|
|
|
|
|
const u32 il_cnt = device_param->kernel_param.il_cnt; // ugly, i know
|
|
|
|
|
|
|
|
|
|
if ((user_options->attack_mode == ATTACK_MODE_STRAIGHT) || (user_options->attack_mode == ATTACK_MODE_ASSOCIATION))
|
|
|
|
|
{
|
|
|
|
|
pw_t pw;
|
|
|
|
|
int rc = 0;
|
|
|
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_BF)
|
|
|
|
|
{
|
|
|
|
|
for (u64 gidvid = 0; gidvid < pws_cnt; gidvid++)
|
|
|
|
|
{
|
|
|
|
|
const int rc = gidd_to_pw_t (hashcat_ctx, device_param, gidvid, &pw);
|
|
|
|
|
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
|
|
|
|
|
{
|
|
|
|
|
u64 l_off = device_param->kernel_params_mp_l_buf64[3] + gidvid;
|
|
|
|
|
u64 r_off = device_param->kernel_params_mp_r_buf64[3] + il_pos;
|
|
|
|
|
|
|
|
|
|
u32 l_start = device_param->kernel_params_mp_l_buf32[5];
|
|
|
|
|
u32 r_start = device_param->kernel_params_mp_r_buf32[5];
|
|
|
|
|
|
|
|
|
|
u32 l_stop = device_param->kernel_params_mp_l_buf32[4];
|
|
|
|
|
u32 r_stop = device_param->kernel_params_mp_r_buf32[4];
|
|
|
|
|
|
|
|
|
|
sp_exec (l_off, (char *) plain_ptr + l_start, mask_ctx->root_css_buf, mask_ctx->markov_css_buf, l_start, l_start + l_stop);
|
|
|
|
|
sp_exec (r_off, (char *) plain_ptr + r_start, mask_ctx->root_css_buf, mask_ctx->markov_css_buf, r_start, r_start + r_stop);
|
|
|
|
|
|
|
|
|
|
plain_len = mask_ctx->css_cnt;
|
|
|
|
|
|
|
|
|
|
if (rc == -1)
|
|
|
|
|
out_push (&out, plain_ptr, plain_len);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (user_options->attack_mode == ATTACK_MODE_HYBRID2)
|
|
|
|
|
{
|
|
|
|
|
for (u64 gidvid = 0; gidvid < pws_cnt; gidvid++)
|
|
|
|
|
{
|
|
|
|
|
if (filename) hc_fclose (&out.fp);
|
|
|
|
|
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
|
|
|
|
|
{
|
|
|
|
|
u64 off = device_param->kernel_params_mp_buf64[3] + gidvid;
|
|
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
u32 start = 0;
|
|
|
|
|
u32 stop = device_param->kernel_params_mp_buf32[4];
|
|
|
|
|
|
|
|
|
|
sp_exec (off, (char *) plain_ptr, mask_ctx->root_css_buf, mask_ctx->markov_css_buf, start, start + stop);
|
|
|
|
|
|
|
|
|
|
plain_len = stop;
|
|
|
|
|
|
|
|
|
|
char *comb_buf = (char *) device_param->combs_buf[il_pos].i;
|
|
|
|
|
u32 comb_len = device_param->combs_buf[il_pos].pw_len;
|
|
|
|
|
|
|
|
|
|
memcpy (plain_ptr + plain_len, comb_buf, comb_len);
|
|
|
|
|
|
|
|
|
|
plain_len += comb_len;
|
|
|
|
|
|
|
|
|
|
if (plain_len > hashconfig->pw_max) plain_len = hashconfig->pw_max;
|
|
|
|
|
|
|
|
|
|
out_push (&out, plain_ptr, plain_len);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// modes below require transferring pw index/buffer data from device to host
|
|
|
|
|
|
|
|
|
|
const u64 blk_cnt_max = device_param->size_pws_idx / (sizeof (pw_idx_t));
|
|
|
|
|
|
|
|
|
|
pw_idx_t *const pws_idx_blk = device_param->pws_idx;
|
|
|
|
|
u32 *const pws_comp_blk = device_param->pws_comp;
|
|
|
|
|
|
|
|
|
|
u64 gidvid_blk = 0; // gidvid of first password in current block
|
|
|
|
|
|
|
|
|
|
while (gidvid_blk < pws_cnt)
|
|
|
|
|
{
|
|
|
|
|
// copy the pw indexes from device for this block
|
|
|
|
|
|
|
|
|
|
u64 remain = pws_cnt - gidvid_blk;
|
|
|
|
|
u64 blk_cnt = MIN (remain, blk_cnt_max);
|
|
|
|
|
|
|
|
|
|
rc = copy_pws_idx (hashcat_ctx, device_param, gidvid_blk, blk_cnt, pws_idx_blk);
|
|
|
|
|
|
|
|
|
|
if (rc == -1) break;
|
|
|
|
|
|
|
|
|
|
const u32 off_blk = (blk_cnt > 0) ? pws_idx_blk[0].off : 0;
|
|
|
|
|
|
|
|
|
|
const pw_idx_t *pw_idx = device_param->pws_idx;
|
|
|
|
|
const pw_idx_t *pw_idx_last = pw_idx + (blk_cnt - 1);
|
|
|
|
|
|
|
|
|
|
// copy the pw buffer data from device for this block
|
|
|
|
|
|
|
|
|
|
u32 copy_cnt = (pw_idx_last->off + pw_idx_last->cnt) - pws_idx_blk->off;
|
|
|
|
|
|
|
|
|
|
rc = copy_pws_comp (hashcat_ctx, device_param, off_blk, copy_cnt, pws_comp_blk);
|
|
|
|
|
|
|
|
|
|
if (rc == -1) break;
|
|
|
|
|
|
|
|
|
|
if ((user_options->attack_mode == ATTACK_MODE_STRAIGHT) || (user_options->attack_mode == ATTACK_MODE_ASSOCIATION))
|
|
|
|
|
{
|
|
|
|
|
while (pw_idx <= pw_idx_last)
|
|
|
|
|
{
|
|
|
|
|
u32 *pw = pws_comp_blk + (pw_idx->off - off_blk);
|
|
|
|
|
u32 pw_len = pw_idx->len;
|
|
|
|
|
|
|
|
|
|
pw_idx++;
|
|
|
|
|
|
|
|
|
|
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
|
|
|
|
|
{
|
|
|
|
@ -127,19 +210,19 @@ int process_stdout (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < 8; i++)
|
|
|
|
|
{
|
|
|
|
|
plain_buf[i] = pw.i[i];
|
|
|
|
|
plain_buf[i] = pw[i];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
plain_len = apply_rules_optimized (straight_ctx->kernel_rules_buf[off].cmds, &plain_buf[0], &plain_buf[4], pw.pw_len);
|
|
|
|
|
plain_len = apply_rules_optimized (straight_ctx->kernel_rules_buf[off].cmds, &plain_buf[0], &plain_buf[4], pw_len);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < 64; i++)
|
|
|
|
|
{
|
|
|
|
|
plain_buf[i] = pw.i[i];
|
|
|
|
|
plain_buf[i] = pw[i];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
plain_len = apply_rules (straight_ctx->kernel_rules_buf[off].cmds, plain_buf, pw.pw_len);
|
|
|
|
|
plain_len = apply_rules (straight_ctx->kernel_rules_buf[off].cmds, plain_buf, pw_len);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (plain_len > hashconfig->pw_max) plain_len = hashconfig->pw_max;
|
|
|
|
@ -150,27 +233,21 @@ int process_stdout (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
|
|
|
|
|
}
|
|
|
|
|
else if (user_options->attack_mode == ATTACK_MODE_COMBI)
|
|
|
|
|
{
|
|
|
|
|
pw_t pw;
|
|
|
|
|
|
|
|
|
|
for (u64 gidvid = 0; gidvid < pws_cnt; gidvid++)
|
|
|
|
|
while (pw_idx <= pw_idx_last)
|
|
|
|
|
{
|
|
|
|
|
const int rc = gidd_to_pw_t (hashcat_ctx, device_param, gidvid, &pw);
|
|
|
|
|
u32 *pw = pws_comp_blk + (pw_idx->off - off_blk);
|
|
|
|
|
u32 pw_len = pw_idx->len;
|
|
|
|
|
|
|
|
|
|
if (rc == -1)
|
|
|
|
|
{
|
|
|
|
|
if (filename) hc_fclose (&out.fp);
|
|
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
pw_idx++;
|
|
|
|
|
|
|
|
|
|
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < 64; i++)
|
|
|
|
|
{
|
|
|
|
|
plain_buf[i] = pw.i[i];
|
|
|
|
|
plain_buf[i] = pw[i];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
plain_len = pw.pw_len;
|
|
|
|
|
plain_len = pw_len;
|
|
|
|
|
|
|
|
|
|
char *comb_buf = (char *) device_param->combs_buf[il_pos].i;
|
|
|
|
|
u32 comb_len = device_param->combs_buf[il_pos].pw_len;
|
|
|
|
@ -194,53 +271,23 @@ int process_stdout (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (user_options->attack_mode == ATTACK_MODE_BF)
|
|
|
|
|
{
|
|
|
|
|
for (u64 gidvid = 0; gidvid < pws_cnt; gidvid++)
|
|
|
|
|
{
|
|
|
|
|
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
|
|
|
|
|
{
|
|
|
|
|
u64 l_off = device_param->kernel_params_mp_l_buf64[3] + gidvid;
|
|
|
|
|
u64 r_off = device_param->kernel_params_mp_r_buf64[3] + il_pos;
|
|
|
|
|
|
|
|
|
|
u32 l_start = device_param->kernel_params_mp_l_buf32[5];
|
|
|
|
|
u32 r_start = device_param->kernel_params_mp_r_buf32[5];
|
|
|
|
|
|
|
|
|
|
u32 l_stop = device_param->kernel_params_mp_l_buf32[4];
|
|
|
|
|
u32 r_stop = device_param->kernel_params_mp_r_buf32[4];
|
|
|
|
|
|
|
|
|
|
sp_exec (l_off, (char *) plain_ptr + l_start, mask_ctx->root_css_buf, mask_ctx->markov_css_buf, l_start, l_start + l_stop);
|
|
|
|
|
sp_exec (r_off, (char *) plain_ptr + r_start, mask_ctx->root_css_buf, mask_ctx->markov_css_buf, r_start, r_start + r_stop);
|
|
|
|
|
|
|
|
|
|
plain_len = mask_ctx->css_cnt;
|
|
|
|
|
|
|
|
|
|
out_push (&out, plain_ptr, plain_len);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (user_options->attack_mode == ATTACK_MODE_HYBRID1)
|
|
|
|
|
{
|
|
|
|
|
pw_t pw;
|
|
|
|
|
|
|
|
|
|
for (u64 gidvid = 0; gidvid < pws_cnt; gidvid++)
|
|
|
|
|
{
|
|
|
|
|
const int rc = gidd_to_pw_t (hashcat_ctx, device_param, gidvid, &pw);
|
|
|
|
|
|
|
|
|
|
if (rc == -1)
|
|
|
|
|
while (pw_idx <= pw_idx_last)
|
|
|
|
|
{
|
|
|
|
|
if (filename) hc_fclose (&out.fp);
|
|
|
|
|
u32 *pw = pws_comp_blk + (pw_idx->off - off_blk);
|
|
|
|
|
u32 pw_len = pw_idx->len;
|
|
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
pw_idx++;
|
|
|
|
|
|
|
|
|
|
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < 64; i++)
|
|
|
|
|
{
|
|
|
|
|
plain_buf[i] = pw.i[i];
|
|
|
|
|
plain_buf[i] = pw[i];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
plain_len = pw.pw_len;
|
|
|
|
|
plain_len = pw_len;
|
|
|
|
|
|
|
|
|
|
u64 off = device_param->kernel_params_mp_buf64[3] + il_pos;
|
|
|
|
|
|
|
|
|
@ -255,43 +302,8 @@ int process_stdout (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (user_options->attack_mode == ATTACK_MODE_HYBRID2)
|
|
|
|
|
{
|
|
|
|
|
pw_t pw;
|
|
|
|
|
|
|
|
|
|
for (u64 gidvid = 0; gidvid < pws_cnt; gidvid++)
|
|
|
|
|
{
|
|
|
|
|
const int rc = gidd_to_pw_t (hashcat_ctx, device_param, gidvid, &pw);
|
|
|
|
|
|
|
|
|
|
if (rc == -1)
|
|
|
|
|
{
|
|
|
|
|
if (filename) hc_fclose (&out.fp);
|
|
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
|
|
|
|
|
{
|
|
|
|
|
u64 off = device_param->kernel_params_mp_buf64[3] + gidvid;
|
|
|
|
|
|
|
|
|
|
u32 start = 0;
|
|
|
|
|
u32 stop = device_param->kernel_params_mp_buf32[4];
|
|
|
|
|
|
|
|
|
|
sp_exec (off, (char *) plain_ptr, mask_ctx->root_css_buf, mask_ctx->markov_css_buf, start, start + stop);
|
|
|
|
|
|
|
|
|
|
plain_len = stop;
|
|
|
|
|
|
|
|
|
|
char *comb_buf = (char *) device_param->combs_buf[il_pos].i;
|
|
|
|
|
u32 comb_len = device_param->combs_buf[il_pos].pw_len;
|
|
|
|
|
|
|
|
|
|
memcpy (plain_ptr + plain_len, comb_buf, comb_len);
|
|
|
|
|
|
|
|
|
|
plain_len += comb_len;
|
|
|
|
|
|
|
|
|
|
if (plain_len > hashconfig->pw_max) plain_len = hashconfig->pw_max;
|
|
|
|
|
|
|
|
|
|
out_push (&out, plain_ptr, plain_len);
|
|
|
|
|
}
|
|
|
|
|
gidvid_blk += blk_cnt; // prepare for next block
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -304,5 +316,5 @@ int process_stdout (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
|
|
|
|
|
hc_fclose (&out.fp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
return rc;
|
|
|
|
|
}
|
|
|
|
|