mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 22:03:42 -07:00
CHG: 'hf mf chk' now correctly tests to read key B, when we specify target keytype B or ?.
CHG: 'hf mf chk' now correctly init all sector keys to 0xFFFFFFFFFFFF, so it looks unified.
This commit is contained in:
parent
77dee16f64
commit
d948e0d140
1 changed files with 37 additions and 31 deletions
|
@ -1168,6 +1168,15 @@ int CmdHF14AMfChk(const char *Cmd) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// empty e_sector
|
||||||
|
for(int i = 0; i < SectorsCnt; ++i){
|
||||||
|
e_sector[i].Key[0] = 0xffffffffffff;
|
||||||
|
e_sector[i].Key[1] = 0xffffffffffff;
|
||||||
|
e_sector[i].foundKey[0] = FALSE;
|
||||||
|
e_sector[i].foundKey[1] = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
uint8_t trgKeyType = 0;
|
uint8_t trgKeyType = 0;
|
||||||
uint32_t max_keys = keycnt > (USB_CMD_DATA_SIZE/6) ? (USB_CMD_DATA_SIZE/6) : keycnt;
|
uint32_t max_keys = keycnt > (USB_CMD_DATA_SIZE/6) ? (USB_CMD_DATA_SIZE/6) : keycnt;
|
||||||
|
|
||||||
|
@ -1183,21 +1192,15 @@ int CmdHF14AMfChk(const char *Cmd) {
|
||||||
// skip already found keys.
|
// skip already found keys.
|
||||||
if (e_sector[i].foundKey[trgKeyType]) continue;
|
if (e_sector[i].foundKey[trgKeyType]) continue;
|
||||||
|
|
||||||
|
|
||||||
for (uint32_t c = 0; c < keycnt; c += max_keys) {
|
for (uint32_t c = 0; c < keycnt; c += max_keys) {
|
||||||
|
|
||||||
uint32_t size = keycnt-c > max_keys ? max_keys : keycnt-c;
|
uint32_t size = keycnt-c > max_keys ? max_keys : keycnt-c;
|
||||||
|
|
||||||
res = mfCheckKeys(b, trgKeyType, true, size, &keyBlock[6*c], &key64);
|
res = mfCheckKeys(b, trgKeyType, true, size, &keyBlock[6*c], &key64);
|
||||||
if (!res) {
|
if (!res) {
|
||||||
//PrintAndLog("Sector:%3d Block:%3d, key type: %C -- Found key [%012"llx"]", i, b, trgKeyType ? 'B':'A', key64);
|
|
||||||
|
|
||||||
e_sector[i].Key[trgKeyType] = key64;
|
e_sector[i].Key[trgKeyType] = key64;
|
||||||
e_sector[i].foundKey[trgKeyType] = TRUE;
|
e_sector[i].foundKey[trgKeyType] = TRUE;
|
||||||
break;
|
break;
|
||||||
} else {
|
|
||||||
e_sector[i].Key[trgKeyType] = 0xffffffffffff;
|
|
||||||
e_sector[i].foundKey[trgKeyType] = FALSE;
|
|
||||||
}
|
}
|
||||||
printf(".");
|
printf(".");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
@ -1210,7 +1213,9 @@ int CmdHF14AMfChk(const char *Cmd) {
|
||||||
printf("\nTime in checkkeys: %.0f ticks\n", (float)t1);
|
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?
|
// 20160116 If Sector A is found, but not Sector B, try just reading it of the tag?
|
||||||
PrintAndLog("testing to read B...");
|
if ( keyType != 1 ) {
|
||||||
|
|
||||||
|
PrintAndLog("testing to read key B...");
|
||||||
for (i = 0; i < SectorsCnt; i++) {
|
for (i = 0; i < SectorsCnt; i++) {
|
||||||
// KEY A but not KEY B
|
// KEY A but not KEY B
|
||||||
if ( e_sector[i].foundKey[0] && !e_sector[i].foundKey[1] ) {
|
if ( e_sector[i].foundKey[0] && !e_sector[i].foundKey[1] ) {
|
||||||
|
@ -1239,6 +1244,7 @@ int CmdHF14AMfChk(const char *Cmd) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//print them
|
//print them
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue