mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 13:00:42 -07:00
chg: 'hf iclass chk' - different output and break the twice-loop when found.
This commit is contained in:
parent
741bb1f485
commit
76fc2cbc2b
1 changed files with 24 additions and 32 deletions
|
@ -755,15 +755,15 @@ void Calc_wb_mac(uint8_t blockno, uint8_t *data, uint8_t *div_key, uint8_t MAC[4
|
||||||
|
|
||||||
static bool select_only(uint8_t *CSN, uint8_t *CCNR, bool use_credit_key, bool verbose) {
|
static bool select_only(uint8_t *CSN, uint8_t *CCNR, bool use_credit_key, bool verbose) {
|
||||||
UsbCommand resp;
|
UsbCommand resp;
|
||||||
|
|
||||||
UsbCommand c = {CMD_READER_ICLASS, {0}};
|
UsbCommand c = {CMD_READER_ICLASS, {0}};
|
||||||
c.arg[0] = FLAG_ICLASS_READER_ONLY_ONCE | FLAG_ICLASS_READER_CC | FLAG_ICLASS_READER_ONE_TRY;
|
c.arg[0] = FLAG_ICLASS_READER_ONLY_ONCE | FLAG_ICLASS_READER_CC | FLAG_ICLASS_READER_ONE_TRY;
|
||||||
|
|
||||||
if (use_credit_key)
|
if (use_credit_key)
|
||||||
c.arg[0] |= FLAG_ICLASS_READER_CEDITKEY;
|
c.arg[0] |= FLAG_ICLASS_READER_CEDITKEY;
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommand(&c);
|
SendCommand(&c);
|
||||||
if (!WaitForResponseTimeout(CMD_ACK,&resp,4500)) {
|
if (!WaitForResponseTimeout(CMD_ACK, &resp, 3000)) {
|
||||||
PrintAndLog("Command execute timeout");
|
PrintAndLog("Command execute timeout");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -808,7 +808,7 @@ static bool select_and_auth(uint8_t *KEY, uint8_t *MAC, uint8_t *div_key, bool u
|
||||||
memcpy(d.d.asBytes, MAC, 4);
|
memcpy(d.d.asBytes, MAC, 4);
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommand(&d);
|
SendCommand(&d);
|
||||||
if (!WaitForResponseTimeout(CMD_ACK,&resp,4500)) {
|
if (!WaitForResponseTimeout(CMD_ACK, &resp, 3000)) {
|
||||||
if (verbose) PrintAndLog("Auth Command execute timeout");
|
if (verbose) PrintAndLog("Auth Command execute timeout");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1897,34 +1897,26 @@ int CmdHFiClassCheckKeys(const char *Cmd) {
|
||||||
memcpy(key, keyBlock + 8 * c , 8);
|
memcpy(key, keyBlock + 8 * c , 8);
|
||||||
|
|
||||||
// debit key. try twice
|
// debit key. try twice
|
||||||
if ( !found_debit ) {
|
for (int foo = 0; foo < 2 && !found_debit; foo++) {
|
||||||
for (int foo = 0; foo < 2; foo++) {
|
|
||||||
if (!select_and_auth(key, mac, div_key, false, elite, rawkey, false))
|
if (!select_and_auth(key, mac, div_key, false, elite, rawkey, false))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// key found.
|
// key found.
|
||||||
PrintAndLog("Found debit key %s || div_key %s",
|
PrintAndLog("\n--------------------------------------------------------");
|
||||||
sprint_hex(key, 8),
|
PrintAndLog(" Found AA1 debit key\t\t[%s]", sprint_hex(key, 8));
|
||||||
sprint_hex(div_key, 8)
|
|
||||||
);
|
|
||||||
found_debit = true;
|
found_debit = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// credit key. try twice
|
// credit key. try twice
|
||||||
if ( !found_credit ) {
|
for (int foo = 0; foo < 2 && !found_credit; foo++) {
|
||||||
for (int foo = 0; foo < 2; foo++) {
|
|
||||||
if (!select_and_auth(key, mac, div_key, true, elite, rawkey, false))
|
if (!select_and_auth(key, mac, div_key, true, elite, rawkey, false))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// key found
|
// key found
|
||||||
PrintAndLog("Found credit key %s || div_key %s",
|
PrintAndLog("\n--------------------------------------------------------");
|
||||||
sprint_hex(key, 8),
|
PrintAndLog(" Found AA2 credit key\t\t[%s]", sprint_hex(key, 8));
|
||||||
sprint_hex(div_key, 8)
|
|
||||||
);
|
|
||||||
found_credit = true;
|
found_credit = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// both keys found.
|
// both keys found.
|
||||||
if ( found_debit && found_credit )
|
if ( found_debit && found_credit )
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue