mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-03-20 12:07:05 +08:00
fix 'hf mf darkside' - adapted solution from @pwpivi
This commit is contained in:
parent
09d8744b84
commit
3464fbe1df
2 changed files with 9 additions and 9 deletions
|
@ -2407,7 +2407,7 @@ void ReaderMifare(bool first_try, uint8_t block, uint8_t keytype ) {
|
||||||
|
|
||||||
// if we missed the sync time already, advance to the next nonce repeat
|
// if we missed the sync time already, advance to the next nonce repeat
|
||||||
while ( GetCountSspClk() > sync_time) {
|
while ( GetCountSspClk() > sync_time) {
|
||||||
elapsed_prng_sequences++;
|
++elapsed_prng_sequences;
|
||||||
sync_time = (sync_time & 0xfffffff8 ) + sync_cycles;
|
sync_time = (sync_time & 0xfffffff8 ) + sync_cycles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2430,7 +2430,7 @@ void ReaderMifare(bool first_try, uint8_t block, uint8_t keytype ) {
|
||||||
|
|
||||||
// we didn't calibrate our clock yet,
|
// we didn't calibrate our clock yet,
|
||||||
// iceman: has to be calibrated every time.
|
// iceman: has to be calibrated every time.
|
||||||
if (first_try && previous_nt && !nt_attacked) {
|
if (previous_nt && !nt_attacked) {
|
||||||
|
|
||||||
int nt_distance = dist_nt(previous_nt, nt);
|
int nt_distance = dist_nt(previous_nt, nt);
|
||||||
|
|
||||||
|
|
|
@ -83,11 +83,7 @@ int mfDarkside(uint8_t blockno, uint8_t key_type, uint64_t *key) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keycount > 1) {
|
PrintAndLog("[+] found %u candidate key%s Trying to verify with authentication...\n", keycount, (keycount > 1) ? "s." : ".");
|
||||||
PrintAndLog("[+] found %u candidate keys. Trying to verify with authentication...\n", keycount);
|
|
||||||
} else {
|
|
||||||
PrintAndLog("[+] found a candidate key. Trying to verify it with authentication...\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
*key = -1;
|
*key = -1;
|
||||||
uint8_t keyBlock[USB_CMD_DATA_SIZE];
|
uint8_t keyBlock[USB_CMD_DATA_SIZE];
|
||||||
|
@ -96,7 +92,9 @@ int mfDarkside(uint8_t blockno, uint8_t key_type, uint64_t *key) {
|
||||||
int size = keycount - i > max_keys ? max_keys : keycount - i;
|
int size = keycount - i > max_keys ? max_keys : keycount - i;
|
||||||
for (int j = 0; j < size; j++) {
|
for (int j = 0; j < size; j++) {
|
||||||
if (par_list == 0) {
|
if (par_list == 0) {
|
||||||
num_to_bytes(last_keylist[i*max_keys + j], 6, keyBlock);
|
if ( last_keylist != NULL ){
|
||||||
|
num_to_bytes(last_keylist[i*max_keys + j], 6, keyBlock);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
num_to_bytes(keylist[i*max_keys + j], 6, keyBlock);
|
num_to_bytes(keylist[i*max_keys + j], 6, keyBlock);
|
||||||
}
|
}
|
||||||
|
@ -111,7 +109,7 @@ int mfDarkside(uint8_t blockno, uint8_t key_type, uint64_t *key) {
|
||||||
free(keylist);
|
free(keylist);
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
PrintAndLog("[-] test authentication failed. Restarting darkside attack");
|
PrintAndLog("[-] all candidate keys failed authentication. Restarting darkside attack");
|
||||||
free(last_keylist);
|
free(last_keylist);
|
||||||
last_keylist = keylist;
|
last_keylist = keylist;
|
||||||
c.arg[0] = true;
|
c.arg[0] = true;
|
||||||
|
@ -905,8 +903,10 @@ int detect_classic_nackbug(bool verbose){
|
||||||
|
|
||||||
// for nice animation
|
// for nice animation
|
||||||
bool term = !isatty(STDIN_FILENO);
|
bool term = !isatty(STDIN_FILENO);
|
||||||
|
#if defined(__linux__)
|
||||||
char star[] = {'-', '\\', '|', '/'};
|
char star[] = {'-', '\\', '|', '/'};
|
||||||
uint8_t staridx = 0;
|
uint8_t staridx = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue