From 83cd6a7761643b27571d45e624d419b39cf72ca6 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Mon, 31 Jul 2017 13:37:41 +0200 Subject: [PATCH] CHG: 'hf mf nested' - (merlokk) https://github.com/merlokk/proxmark3/commit/76fcccd10992566b9fa7187097a3056fbb1c5619 CHG: 'hf mf hardnested' added same verification also here. --- client/cmdhfmf.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/client/cmdhfmf.c b/client/cmdhfmf.c index 543ee7403..e0b94fa95 100644 --- a/client/cmdhfmf.c +++ b/client/cmdhfmf.c @@ -825,12 +825,19 @@ int CmdHF14AMfNested(const char *Cmd) { } ctmp = param_getchar(Cmd, 4); - if (ctmp == 't' || ctmp == 'T') transferToEml = true; - else if (ctmp == 'd' || ctmp == 'D') createDumpFile = true; + transferToEml |= (ctmp == 't' || ctmp == 'T'); + createDumpFile |= (ctmp == 'd' || ctmp == 'D'); ctmp = param_getchar(Cmd, 6); transferToEml |= (ctmp == 't' || ctmp == 'T'); - transferToEml |= (ctmp == 'd' || ctmp == 'D'); + createDumpFile |= (ctmp == 'd' || ctmp == 'D'); + + // check if we can authenticate to sector + res = mfCheckKeys(blockNo, keyType, true, 1, key, &key64); + if (res) { + PrintAndLog("Key is wrong. Can't authenticate to block:%3d key type:%c", blockNo, keyType ? 'B' : 'A'); + return 3; + } if (cmdp == 'o') { int16_t isOK = mfnested(blockNo, keyType, key, trgBlockNo, trgKeyType, keyBlock, true); @@ -1090,6 +1097,14 @@ int CmdHF14AMfNestedHard(const char *Cmd) { i++; } } + + uint64_t key64 = 0; + // check if we can authenticate to sector + int res = mfCheckKeys(blockNo, keyType, true, 1, key, &key64); + if (res) { + PrintAndLog("Key is wrong. Can't authenticate to block:%3d key type:%c", blockNo, keyType ? 'B' : 'A'); + return 3; + } PrintAndLog("--target block no:%3d, target key type:%c, known target key: 0x%02x%02x%02x%02x%02x%02x%s, file action: %s, Slow: %s, Tests: %d ", trgBlockNo,