diff --git a/module/mifare.cpp b/module/mifare.cpp index 912e599..ffa2663 100644 --- a/module/mifare.cpp +++ b/module/mifare.cpp @@ -323,8 +323,7 @@ void Mifare::writeAll() { for(int j = 0; j < cardType.blk[i]; j++) { - result = ""; // if the KeyA is invalid and the result is not empty, the - // KeyB will not be tested. + result = ""; // if the KeyA is valid and the result is not empty, the KeyB will not be tested. if(data_isDataValid(dataList->at(cardType.blks[i] + j)) != DATA_NOSPACE || dataList->at(cardType.blks[i] + j).contains('?')) continue; if(data_isKeyValid(keyAList->at(i))) @@ -350,6 +349,15 @@ void Mifare::writeAll() + dataList->at(cardType.blks[i] + j), waitTime); } + if(result.indexOf("isOk:01") == -1 && keyAList->at(i) != "FFFFFFFFFFFF") // Try default key. It's useful when writing to a blank card + { + result = util->execCMDWithOutput( + "hf mf wrbl " + + QString::number(cardType.blks[i] + j) + + " A FFFFFFFFFFFF " + + dataList->at(cardType.blks[i] + j), + waitTime); + } } } }