X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/d433698311f055d0f804c4009936e7d325ae5815..b403c300910c62cbacf95be213efdc6ed8ed85d1:/client/cmdhfmf.c diff --git a/client/cmdhfmf.c b/client/cmdhfmf.c index ea73bf95..2e58986d 100644 --- a/client/cmdhfmf.c +++ b/client/cmdhfmf.c @@ -214,9 +214,10 @@ start: } } printf("\n"); + // error + if (isOK != 1) return 1; - // par == 0, and -4 - if (isOK == -4 && par_list == 0) { + if (par_list == 0 && ks_list != 0) { // this special attack when parities is zero, uses checkkeys. Which now with block/keytype option also needs. // but it uses 0|1 instead of 0x60|0x61... if (nonce2key_ex(blockNo, keytype - 0x60 , uid, nt, nr, ks_list, &r_key) ){ @@ -229,10 +230,7 @@ start: goto END; } } - - // error - if (isOK != 1) return 1; - + // execute original function from util nonce2key if (nonce2key(uid, nt, nr, par_list, ks_list, &r_key)) { isOK = 2; @@ -1365,7 +1363,7 @@ int CmdHF14AMfChk(const char *Cmd) { #define ATTACK_KEY_COUNT 8 sector *k_sector = NULL; uint8_t k_sectorsCount = 16; -void readerAttack(nonces_t data[], bool setEmulatorMem, bool showMaths) { +void readerAttack(nonces_t data[], bool setEmulatorMem, bool verbose) { // initialize storage for found keys if (k_sector == NULL) @@ -1389,7 +1387,7 @@ void readerAttack(nonces_t data[], bool setEmulatorMem, bool showMaths) { // We can probably skip this, mfkey32v2 is more reliable. #ifdef HFMF_TRYMFK32 - if (tryMfk32(data[i], &key)) { + if (tryMfk32(data[i], &key, verbose)) { PrintAndLog("Found Key%s for sector %02d: [%012"llx"]" , (data[i].keytype) ? "B" : "A" , data[i].sector @@ -1414,7 +1412,7 @@ void readerAttack(nonces_t data[], bool setEmulatorMem, bool showMaths) { } #endif //moebius attack - if (tryMfk32_moebius(data[i+ATTACK_KEY_COUNT], &key, showMaths)) { + if (tryMfk32_moebius(data[i+ATTACK_KEY_COUNT], &key, verbose)) { uint8_t sectorNum = data[i+ATTACK_KEY_COUNT].sector; uint8_t keyType = data[i+ATTACK_KEY_COUNT].keytype; @@ -1456,7 +1454,7 @@ int CmdHF14AMf1kSim(const char *Cmd) { bool errors = false; // If set to true, we should show our workings when doing NR_AR_ATTACK. - bool showMaths = false; + bool verbose = false; while(param_getchar(Cmd, cmdp) != 0x00) { switch(param_getchar(Cmd, cmdp)) { @@ -1491,7 +1489,7 @@ int CmdHF14AMf1kSim(const char *Cmd) { break; case 'v': case 'V': - showMaths = true; + verbose = true; cmdp++; break; case 'x': @@ -1533,7 +1531,7 @@ int CmdHF14AMf1kSim(const char *Cmd) { if ( (resp.arg[0] & 0xffff) != CMD_SIMULATE_MIFARE_CARD ) break; memcpy( data, resp.d.asBytes, sizeof(data) ); - readerAttack(data, setEmulatorMem, showMaths); + readerAttack(data, setEmulatorMem, verbose); } if (k_sector != NULL) {