chg: 'hf mf chk' - break on keypress.

chg:  'hf mf fchk' - break on keypress.
This commit is contained in:
iceman1001 2017-12-13 10:17:30 +01:00
parent 972fb2e167
commit 8526e74af8

View file

@ -1315,6 +1315,12 @@ int CmdHF14AMfChk_fast(const char *Cmd) {
// main keychunk loop // main keychunk loop
for (uint32_t i = 0; i < keycnt; i += chunksize) { for (uint32_t i = 0; i < keycnt; i += chunksize) {
if (ukbhit()) {
int gc = getchar(); (void)gc;
printf("\naborted via keyboard!\n");
goto out;
}
uint32_t size = ((keycnt - i) > chunksize) ? chunksize : keycnt - i; uint32_t size = ((keycnt - i) > chunksize) ? chunksize : keycnt - i;
// last chunk? // last chunk?
@ -1545,7 +1551,14 @@ int CmdHF14AMfChk(const char *Cmd) {
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) {
printf("."); fflush(stdout);
printf("."); fflush(stdout);
if (ukbhit()) {
int gc = getchar(); (void)gc;
printf("\naborted via keyboard!\n");
goto out;
}
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);
@ -1554,6 +1567,8 @@ int CmdHF14AMfChk(const char *Cmd) {
e_sector[i].foundKey[trgKeyType] = true; e_sector[i].foundKey[trgKeyType] = true;
break; break;
} }
} }
b < 127 ? ( b +=4 ) : ( b += 16 ); b < 127 ? ( b +=4 ) : ( b += 16 );
} }
@ -1595,6 +1610,8 @@ int CmdHF14AMfChk(const char *Cmd) {
} }
} }
out:
//print keys //print keys
printKeyTable( SectorsCnt, e_sector ); printKeyTable( SectorsCnt, e_sector );
@ -1632,7 +1649,7 @@ int CmdHF14AMfChk(const char *Cmd) {
fclose(fkeys); fclose(fkeys);
PrintAndLog("Found keys have been dumped to file dumpkeys.bin. 0xffffffffffff has been inserted for unknown keys."); PrintAndLog("Found keys have been dumped to file dumpkeys.bin. 0xffffffffffff has been inserted for unknown keys.");
} }
free(keyBlock); free(keyBlock);
free(e_sector); free(e_sector);
PrintAndLog(""); PrintAndLog("");