mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-22 14:13:42 -07:00
hf mf chk. add timeout (arm side) and some tweaks.
This commit is contained in:
parent
448abaec60
commit
b2a820eb0b
4 changed files with 14 additions and 6 deletions
|
@ -29,4 +29,5 @@ extern void iso14443a_setup(uint8_t fpga_minor_mode);
|
|||
extern int iso14_apdu(uint8_t *cmd, uint16_t cmd_len, void *data);
|
||||
extern int iso14443a_select_card(uint8_t *uid_ptr, iso14a_card_select_t *resp_data, uint32_t *cuid_ptr, bool anticollision, uint8_t num_cascades, bool no_rats);
|
||||
extern void iso14a_set_trigger(bool enable);
|
||||
extern void iso14a_set_timeout(uint32_t timeout);
|
||||
#endif /* __ISO14443A_H */
|
||||
|
|
|
@ -963,6 +963,7 @@ void MifareChkKeys(uint16_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain)
|
|||
uint8_t keyType = (arg0 >> 8) & 0xff;
|
||||
bool clearTrace = arg1 & 0x01;
|
||||
bool multisectorCheck = arg1 & 0x02;
|
||||
uint8_t set14aTimeout = (arg1 >> 8) & 0xff;
|
||||
uint8_t keyCount = arg2;
|
||||
|
||||
// clear debug level
|
||||
|
@ -977,6 +978,10 @@ void MifareChkKeys(uint16_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain)
|
|||
if (clearTrace) clear_trace();
|
||||
set_tracing(true);
|
||||
|
||||
if (!set14aTimeout){
|
||||
iso14a_set_timeout(set14aTimeout * 10); // timeout: ms = x/106 35-minimum, 50-OK 106-recommended 500-safe
|
||||
}
|
||||
|
||||
if (multisectorCheck) {
|
||||
TKeyIndex keyIndex = {0};
|
||||
uint8_t sectorCnt = blockNo;
|
||||
|
|
|
@ -797,7 +797,7 @@ int MifareChkBlockKey(uint8_t *uid, uint32_t *cuid, uint8_t *cascade_levels, uin
|
|||
}
|
||||
|
||||
if(mifare_classic_auth(pcs, *cuid, blockNo, keyType, ui64Key, AUTH_FIRST)) {
|
||||
SpinDelayUs(AUTHENTICATION_TIMEOUT);
|
||||
// SpinDelayUs(AUTHENTICATION_TIMEOUT);
|
||||
return 2;
|
||||
} else {
|
||||
// it needs after success authentication
|
||||
|
@ -830,11 +830,13 @@ int MifareChkBlockKeys(uint8_t *keys, uint8_t keyCount, uint8_t blockNo, uint8_t
|
|||
if (res == 1) {
|
||||
retryCount++;
|
||||
if (retryCount >= 5) {
|
||||
Dbprintf("ChkKeys: block=%d key=%d. Can't select. Exit...", blockNo, keyType);
|
||||
return -1;
|
||||
}
|
||||
--i; // try the same key once again
|
||||
SpinDelay(50);
|
||||
//Dbprintf("ChkKeys: block=%d key=%d. Try the same key once again...", blockNo, keyType);
|
||||
|
||||
SpinDelay(20);
|
||||
// Dbprintf("ChkKeys: block=%d key=%d. Try the same key once again...", blockNo, keyType);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -854,7 +856,7 @@ int MifareChkBlockKeys(uint8_t *keys, uint8_t keyCount, uint8_t blockNo, uint8_t
|
|||
int MifareMultisectorChk(uint8_t *keys, uint8_t keyCount, uint8_t SectorCount, uint8_t keyType, uint8_t debugLevel, TKeyIndex *keyIndex) {
|
||||
int res = 0;
|
||||
|
||||
int clk = GetCountSspClk();
|
||||
// int clk = GetCountSspClk();
|
||||
|
||||
for(int sc = 0; sc < SectorCount; sc++){
|
||||
WDT_HIT();
|
||||
|
@ -871,7 +873,7 @@ int MifareMultisectorChk(uint8_t *keys, uint8_t keyCount, uint8_t SectorCount, u
|
|||
} while(--keyAB > 0);
|
||||
}
|
||||
|
||||
Dbprintf("%d %d", GetCountSspClk() - clk, (GetCountSspClk() - clk)/(SectorCount*keyCount*(keyType==2?2:1)));
|
||||
// Dbprintf("%d %d", GetCountSspClk() - clk, (GetCountSspClk() - clk)/(SectorCount*keyCount*(keyType==2?2:1)));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1089,7 +1089,7 @@ int CmdHF14AMfChk(const char *Cmd)
|
|||
bool foundAKey = false;
|
||||
uint32_t max_keys = keycnt > USB_CMD_DATA_SIZE / 6 ? USB_CMD_DATA_SIZE / 6 : keycnt;
|
||||
if (SectorsCnt) {
|
||||
PrintAndLog("To cancel this operation by press the button on the proxmark...");
|
||||
PrintAndLog("To cancel this operation press the button on the proxmark...");
|
||||
printf("--");
|
||||
for (uint32_t c = 0; c < keycnt; c += max_keys) {
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue