CHG: removing some time-debug statements.
CHG: increased the time-out message 2sec, in proxmark, to make "hf mf chk" work better. CHG: still trying to solve the "hf mf mifare" WDT_HIT bug. With these changes, the "hf mf chk" / "Hf mf nested" looks similar and should be a bit faster.
This commit is contained in:
@@ -101,7 +101,7 @@ start:
|
||||
|
||||
t1 = clock() - t1;
|
||||
if ( t1 > 0 )
|
||||
PrintAndLog("Time in darkside: %.0f ticks - %4.2f sec\n", (float)t1, ((float)t1)/CLOCKS_PER_SEC);
|
||||
PrintAndLog("Time in darkside: %.0f ticks\n", (float)t1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -707,7 +707,7 @@ int CmdHF14AMfNested(const char *Cmd)
|
||||
}
|
||||
clock_t t2 = clock() - t1;
|
||||
if ( t2 > 0 )
|
||||
PrintAndLog("Time to check 6 known keys: %.0f ticks %4.2f sec", (float)t2, ((float)t2)/CLOCKS_PER_SEC);
|
||||
PrintAndLog("Time to check 6 known keys: %.0f ticks", (float)t2 );
|
||||
|
||||
PrintAndLog("enter nested...");
|
||||
|
||||
@@ -747,7 +747,7 @@ int CmdHF14AMfNested(const char *Cmd)
|
||||
|
||||
t1 = clock() - t1;
|
||||
if ( t1 > 0 )
|
||||
PrintAndLog("Time in nested: %.0f ticks %4.2f sec (%4.2f sec per key)\n", (float)t1, ((float)t1)/CLOCKS_PER_SEC, ((float)t1)/iterations/CLOCKS_PER_SEC);
|
||||
PrintAndLog("Time in nested: %.0f ticks \n", (float)t1);
|
||||
|
||||
// 20160116 If Sector A is found, but not Sector B, try just reading it of the tag?
|
||||
PrintAndLog("trying to read key B...");
|
||||
@@ -1150,14 +1150,14 @@ int CmdHF14AMfChk(const char *Cmd)
|
||||
e_sector[i].Key[trgKeyType] = 0xffffffffffff;
|
||||
e_sector[i].foundKey[trgKeyType] = FALSE;
|
||||
}
|
||||
printf(".");
|
||||
}
|
||||
b < 127 ? ( b +=4 ) : ( b += 16 );
|
||||
}
|
||||
}
|
||||
|
||||
t1 = clock() - t1;
|
||||
if ( t1 > 0 )
|
||||
printf("Time in checkkeys: %.0f ticks %1.2f sec (%1.2f sec per key)\n\n", (float)t1, ((float)t1)/CLOCKS_PER_SEC, ((float)t1)/keycnt/CLOCKS_PER_SEC);
|
||||
printf("\nTime in checkkeys: %.0f ticks\n", (float)t1);
|
||||
|
||||
// 20160116 If Sector A is found, but not Sector B, try just reading it of the tag?
|
||||
PrintAndLog("testing to read B...");
|
||||
|
||||
@@ -66,10 +66,8 @@ typedef
|
||||
// wrapper function for multi-threaded lfsr_recovery32
|
||||
void* nested_worker_thread(void *arg)
|
||||
{
|
||||
clock_t t1 = clock();
|
||||
struct Crypto1State *p1;
|
||||
StateList_t *statelist = arg;
|
||||
|
||||
statelist->head.slhead = lfsr_recovery32(statelist->ks1, statelist->nt ^ statelist->uid);
|
||||
|
||||
for (p1 = statelist->head.slhead; *(uint64_t *)p1 != 0; p1++);
|
||||
@@ -77,10 +75,6 @@ void* nested_worker_thread(void *arg)
|
||||
statelist->len = p1 - statelist->head.slhead;
|
||||
statelist->tail.sltail = --p1;
|
||||
qsort(statelist->head.slhead, statelist->len, sizeof(uint64_t), Compare16Bits);
|
||||
|
||||
|
||||
t1 = clock() - t1;
|
||||
printf("lfsr_recovery32 takes %.0f ticks \n", (float)t1);
|
||||
return statelist->head.slhead;
|
||||
}
|
||||
|
||||
@@ -192,7 +186,6 @@ int mfnested(uint8_t blockNo, uint8_t keyType, uint8_t * key, uint8_t trgBlockNo
|
||||
// uint32_t max_keys = keycnt > (USB_CMD_DATA_SIZE/6) ? (USB_CMD_DATA_SIZE/6) : keycnt;
|
||||
uint8_t keyBlock[USB_CMD_DATA_SIZE] = {0x00};
|
||||
|
||||
clock_t t1 = clock();
|
||||
for (i = 0; i < numOfCandidates; ++i){
|
||||
crypto1_get_lfsr(statelists[0].head.slhead + i, &key64);
|
||||
num_to_bytes(key64, 6, keyBlock + i * 6);
|
||||
@@ -203,9 +196,6 @@ int mfnested(uint8_t blockNo, uint8_t keyType, uint8_t * key, uint8_t trgBlockNo
|
||||
free(statelists[1].head.slhead);
|
||||
num_to_bytes(key64, 6, resultKey);
|
||||
|
||||
t1 = clock() - t1;
|
||||
printf("Check candidates takes %.0f ticks \n", (float)t1);
|
||||
|
||||
PrintAndLog("UID: %08x target block:%3u key type: %c -- Found key [%012"llx"]",
|
||||
uid,
|
||||
(uint16_t)resp.arg[2] & 0xff,
|
||||
@@ -235,7 +225,7 @@ int mfCheckKeys (uint8_t blockNo, uint8_t keyType, bool clear_trace, uint8_t key
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
UsbCommand resp;
|
||||
if (!WaitForResponseTimeout(CMD_ACK,&resp, 3000)) return 1;
|
||||
if (!WaitForResponseTimeout(CMD_ACK,&resp, 2500)) return 1;
|
||||
if ((resp.arg[0] & 0xff) != 0x01) return 2;
|
||||
*key = bytes_to_num(resp.d.asBytes, 6);
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user