From c0c580bc6663253a01daa797e6573fc3becdc23a Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Thu, 3 Sep 2020 10:31:50 +0200 Subject: [PATCH] ecfill - dont break of a bad read, fill w zeros and report back partial dump --- armsrc/mifarecmd.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/armsrc/mifarecmd.c b/armsrc/mifarecmd.c index 8169a3393..6f84fd80a 100644 --- a/armsrc/mifarecmd.c +++ b/armsrc/mifarecmd.c @@ -1964,10 +1964,13 @@ int MifareECardLoad(uint8_t sectorcnt, uint8_t keytype) { for (uint8_t blockNo = 0; blockNo < NumBlocksPerSector(sectorNo); blockNo++) { if (mifare_classic_readblock(pcs, cuid, FirstBlockOfSector(sectorNo) + blockNo, dataoutbuf)) { - retval = PM3_ESOFT; + retval = PM3_EPARTIAL; + emlSetMem("\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", FirstBlockOfSector(sectorNo) + blockNo, 1); + if (DBGLEVEL > DBG_ERROR) Dbprintf("Error reading sector %2d block %2d", sectorNo, blockNo); - break; + continue; } + if (blockNo < NumBlocksPerSector(sectorNo) - 1) { emlSetMem(dataoutbuf, FirstBlockOfSector(sectorNo) + blockNo, 1); } else { // sector trailer, keep the keys, set only the AC