X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/32beef538ec649e9be182f952f490ffa6f3566cd..680433820190cca9441042cb835fb0d229f674a3:/client/cmdhfmf.c diff --git a/client/cmdhfmf.c b/client/cmdhfmf.c index ea73bf95..7114945d 100644 --- a/client/cmdhfmf.c +++ b/client/cmdhfmf.c @@ -214,14 +214,14 @@ 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) ){ - PrintAndLog("Key not found (lfsr_common_prefix list is null)."); - PrintAndLog("Failing is expected to happen in 25%% of all cases. Trying again with a different reader nonce..."); + PrintAndLog("Trying again with a different reader nonce..."); c.arg[0] = false; goto start; } else { @@ -229,10 +229,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 +1362,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 +1386,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 +1411,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 +1453,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 +1488,7 @@ int CmdHF14AMf1kSim(const char *Cmd) { break; case 'v': case 'V': - showMaths = true; + verbose = true; cmdp++; break; case 'x': @@ -1533,7 +1530,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) {