From 703329faca57d8f115ab94d8c31dbe02b321508b Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 27 Aug 2019 11:08:03 +0200 Subject: [PATCH] chg: add used known key to found list :) --- client/cmdhfmf.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/client/cmdhfmf.c b/client/cmdhfmf.c index af2db10ab..d2004d142 100644 --- a/client/cmdhfmf.c +++ b/client/cmdhfmf.c @@ -751,7 +751,12 @@ static uint8_t NumBlocksPerSector(uint8_t sectorNo) { return 16; } } - +static uint8_t GetSectorFromBlockNo(uint8_t blockNo) { + if ( blockNo < 128 ) + return blockNo / 4; + else + return 32 + ((128 - blockNo) / 16); +} static int CmdHF14AMfDump(const char *Cmd) { uint64_t t1 = msclock(); @@ -1222,6 +1227,10 @@ static int CmdHF14AMfNested(const char *Cmd) { e_sector = calloc(SectorsCnt, sizeof(sector_t)); if (e_sector == NULL) return PM3_EMALLOC; + // add our known key + e_sector[GetSectorFromBlockNo(blockNo)].foundKey[keyType] = 1; + e_sector[GetSectorFromBlockNo(blockNo)].Key[keyType] = key64; + //test current key and additional standard keys first // add parameter key memcpy(keyBlock + (ARRAYLEN(g_mifare_default_keys) * 6), key, 6);