1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-26 09:58:16 +00:00

Do not modify the original positions of mac1, mac2, nonce1 and nonce2 in hccap files

Should fix https://github.com/hashcat/oclHashcat/issues/288
This commit is contained in:
Jens Steube 2016-04-17 10:44:14 +02:00
parent e7a205cee6
commit 1bc9e3ec85
4 changed files with 63 additions and 108 deletions

View File

@ -1433,6 +1433,10 @@ typedef struct
u32 eapol[64]; u32 eapol[64];
int eapol_size; int eapol_size;
int keyver; int keyver;
u8 orig_mac1[6];
u8 orig_mac2[6];
u8 orig_nonce1[32];
u8 orig_nonce2[32];
} wpa_t; } wpa_t;

View File

@ -64,6 +64,10 @@ typedef struct
uint eapol[64]; uint eapol[64];
int eapol_size; int eapol_size;
int keyver; int keyver;
u8 orig_mac1[6];
u8 orig_mac2[6];
u8 orig_nonce1[32];
u8 orig_nonce2[32];
} wpa_t; } wpa_t;

View File

@ -1070,35 +1070,20 @@ void status_display ()
{ {
wpa_t *wpa = (wpa_t *) data.esalts_buf; wpa_t *wpa = (wpa_t *) data.esalts_buf;
uint pke[25] = { 0 };
char *pke_ptr = (char *) pke;
for (uint i = 0; i < 25; i++)
{
pke[i] = byte_swap_32 (wpa->pke[i]);
}
char mac1[6] = { 0 };
char mac2[6] = { 0 };
memcpy (mac1, pke_ptr + 23, 6);
memcpy (mac2, pke_ptr + 29, 6);
log_info ("Hash.Target....: %s (%02x:%02x:%02x:%02x:%02x:%02x <-> %02x:%02x:%02x:%02x:%02x:%02x)", log_info ("Hash.Target....: %s (%02x:%02x:%02x:%02x:%02x:%02x <-> %02x:%02x:%02x:%02x:%02x:%02x)",
(char *) data.salts_buf[0].salt_buf, (char *) data.salts_buf[0].salt_buf,
mac1[0] & 0xff, wpa->orig_mac1[0],
mac1[1] & 0xff, wpa->orig_mac1[1],
mac1[2] & 0xff, wpa->orig_mac1[2],
mac1[3] & 0xff, wpa->orig_mac1[3],
mac1[4] & 0xff, wpa->orig_mac1[4],
mac1[5] & 0xff, wpa->orig_mac1[5],
mac2[0] & 0xff, wpa->orig_mac2[0],
mac2[1] & 0xff, wpa->orig_mac2[1],
mac2[2] & 0xff, wpa->orig_mac2[2],
mac2[3] & 0xff, wpa->orig_mac2[3],
mac2[4] & 0xff, wpa->orig_mac2[4],
mac2[5] & 0xff); wpa->orig_mac2[5]);
} }
else if (data.hash_mode == 5200) else if (data.hash_mode == 5200)
{ {
@ -4176,28 +4161,14 @@ static void *thread_outfile_remove (void *p)
wpa_t *wpas = (wpa_t *) data.esalts_buf; wpa_t *wpas = (wpa_t *) data.esalts_buf;
wpa_t *wpa = &wpas[salt_pos]; wpa_t *wpa = &wpas[salt_pos];
uint pke[25] = { 0 };
char *pke_ptr = (char *) pke;
for (uint i = 0; i < 25; i++)
{
pke[i] = byte_swap_32 (wpa->pke[i]);
}
u8 mac1[6] = { 0 };
u8 mac2[6] = { 0 };
memcpy (mac1, pke_ptr + 23, 6);
memcpy (mac2, pke_ptr + 29, 6);
// compare hex string(s) vs binary MAC address(es) // compare hex string(s) vs binary MAC address(es)
for (uint i = 0, j = 0; i < 6; i++, j += 2) for (uint i = 0, j = 0; i < 6; i++, j += 2)
{ {
if (mac1[i] != hex_to_u8 ((const u8 *) &mac1_pos[j])) if (wpa->orig_mac1[i] != hex_to_u8 ((const u8 *) &mac1_pos[j]))
{ {
cracked = 0; cracked = 0;
break; break;
} }
} }
@ -4207,9 +4178,10 @@ static void *thread_outfile_remove (void *p)
for (uint i = 0, j = 0; i < 6; i++, j += 2) for (uint i = 0, j = 0; i < 6; i++, j += 2)
{ {
if (mac2[i] != hex_to_u8 ((const u8 *) &mac2_pos[j])) if (wpa->orig_mac2[i] != hex_to_u8 ((const u8 *) &mac2_pos[j]))
{ {
cracked = 0; cracked = 0;
break; break;
} }
} }
@ -11096,16 +11068,23 @@ int main (int argc, char **argv)
wpa_t *wpa = (wpa_t *) hashes_buf[hashes_cnt].esalt; wpa_t *wpa = (wpa_t *) hashes_buf[hashes_cnt].esalt;
u8 *pke_ptr = (u8 *) wpa->pke;
// do the appending task // do the appending task
snprintf (salt_ptr + cur_pos, snprintf (salt_ptr + cur_pos,
rem_len, rem_len,
":%02x%02x%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x", ":%02x%02x%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x",
pke_ptr[20], pke_ptr[27], pke_ptr[26], pke_ptr[25], pke_ptr[24], pke_ptr[31], // MAC1 wpa->orig_mac1[0],
pke_ptr[30], pke_ptr[29], pke_ptr[28], pke_ptr[35], pke_ptr[34], pke_ptr[33]); // MAC2 wpa->orig_mac1[1],
wpa->orig_mac1[2],
wpa->orig_mac1[3],
wpa->orig_mac1[4],
wpa->orig_mac1[5],
wpa->orig_mac2[0],
wpa->orig_mac2[1],
wpa->orig_mac2[2],
wpa->orig_mac2[3],
wpa->orig_mac2[4],
wpa->orig_mac2[5]);
// memset () the remaining part of the salt // memset () the remaining part of the salt
@ -11972,28 +11951,14 @@ int main (int argc, char **argv)
{ {
wpa_t *wpa = (wpa_t *) found->esalt; wpa_t *wpa = (wpa_t *) found->esalt;
uint pke[25] = { 0 };
char *pke_ptr = (char *) pke;
for (uint i = 0; i < 25; i++)
{
pke[i] = byte_swap_32 (wpa->pke[i]);
}
u8 mac1[6] = { 0 };
u8 mac2[6] = { 0 };
memcpy (mac1, pke_ptr + 23, 6);
memcpy (mac2, pke_ptr + 29, 6);
// compare hex string(s) vs binary MAC address(es) // compare hex string(s) vs binary MAC address(es)
for (uint i = 0, j = 0; i < 6; i++, j += 2) for (uint i = 0, j = 0; i < 6; i++, j += 2)
{ {
if (mac1[i] != hex_to_u8 ((const u8 *) &mac1_pos[j])) if (wpa->orig_mac1[i] != hex_to_u8 ((const u8 *) &mac1_pos[j]))
{ {
found = NULL; found = NULL;
break; break;
} }
} }
@ -12003,9 +11968,10 @@ int main (int argc, char **argv)
for (uint i = 0, j = 0; i < 6; i++, j += 2) for (uint i = 0, j = 0; i < 6; i++, j += 2)
{ {
if (mac2[i] != hex_to_u8 ((const u8 *) &mac2_pos[j])) if (wpa->orig_mac2[i] != hex_to_u8 ((const u8 *) &mac2_pos[j]))
{ {
found = NULL; found = NULL;
break; break;
} }
} }

View File

@ -6581,35 +6581,20 @@ void ascii_digest (char *out_buf, uint salt_pos, uint digest_pos)
wpa_t *wpa = &wpas[salt_pos]; wpa_t *wpa = &wpas[salt_pos];
uint pke[25] = { 0 };
char *pke_ptr = (char *) pke;
for (uint i = 0; i < 25; i++)
{
pke[i] = byte_swap_32 (wpa->pke[i]);
}
unsigned char mac1[6] = { 0 };
unsigned char mac2[6] = { 0 };
memcpy (mac1, pke_ptr + 23, 6);
memcpy (mac2, pke_ptr + 29, 6);
snprintf (out_buf, len-1, "%s:%02x%02x%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x", snprintf (out_buf, len-1, "%s:%02x%02x%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x",
(char *) salt.salt_buf, (char *) salt.salt_buf,
mac1[0], wpa->orig_mac1[0],
mac1[1], wpa->orig_mac1[1],
mac1[2], wpa->orig_mac1[2],
mac1[3], wpa->orig_mac1[3],
mac1[4], wpa->orig_mac1[4],
mac1[5], wpa->orig_mac1[5],
mac2[0], wpa->orig_mac2[0],
mac2[1], wpa->orig_mac2[1],
mac2[2], wpa->orig_mac2[2],
mac2[3], wpa->orig_mac2[3],
mac2[4], wpa->orig_mac2[4],
mac2[5]); wpa->orig_mac2[5]);
} }
else if (hash_mode == 4400) else if (hash_mode == 4400)
{ {
@ -8787,19 +8772,10 @@ void to_hccap_t (hccap_t *hccap, uint salt_pos, uint digest_pos)
memcpy (hccap->eapol, wpa->eapol, wpa->eapol_size); memcpy (hccap->eapol, wpa->eapol, wpa->eapol_size);
} }
uint pke_tmp[25] = { 0 }; memcpy (hccap->mac1, wpa->orig_mac1, 6);
memcpy (hccap->mac2, wpa->orig_mac2, 6);
for (int i = 5; i < 25; i++) memcpy (hccap->nonce1, wpa->orig_nonce1, 32);
{ memcpy (hccap->nonce2, wpa->orig_nonce2, 32);
pke_tmp[i] = byte_swap_32 (wpa->pke[i]);
}
char *pke_ptr = (char *) pke_tmp;
memcpy (hccap->mac1, pke_ptr + 23, 6);
memcpy (hccap->mac2, pke_ptr + 29, 6);
memcpy (hccap->nonce1, pke_ptr + 67, 32);
memcpy (hccap->nonce2, pke_ptr + 35, 32);
char *digests_buf_ptr = (char *) data.digests_buf; char *digests_buf_ptr = (char *) data.digests_buf;
@ -10259,6 +10235,11 @@ int wpa_parse_hash (char *input_buf, uint input_len, hash_t *hash_buf)
wpa->pke[i] = byte_swap_32 (wpa->pke[i]); wpa->pke[i] = byte_swap_32 (wpa->pke[i]);
} }
memcpy (wpa->orig_mac1, in.mac1, 6);
memcpy (wpa->orig_mac2, in.mac2, 6);
memcpy (wpa->orig_nonce1, in.nonce1, 32);
memcpy (wpa->orig_nonce2, in.nonce2, 32);
wpa->keyver = in.keyver; wpa->keyver = in.keyver;
if (wpa->keyver > 255) if (wpa->keyver > 255)