hf mf mad - text

This commit is contained in:
iceman1001 2020-12-30 22:05:28 +01:00
commit c3ea0c83ad

View file

@ -4884,16 +4884,20 @@ static int CmdHF14AMfMAD(const char *Cmd) {
uint8_t sector10[16 * 4] = {0}; uint8_t sector10[16 * 4] = {0};
bool got_first = true; bool got_first = true;
if (mfReadSector(MF_MAD1_SECTOR, MF_KEY_A, (uint8_t *)g_mifare_mad_key, sector0)) { if (mfReadSector(MF_MAD1_SECTOR, MF_KEY_A, (uint8_t *)g_mifare_mad_key, sector0) != PM3_SUCCESS) {
PrintAndLogEx(ERR, "error, read sector 0. card don't have MAD or don't have MAD on default keys"); PrintAndLogEx(WARNING, "error, read sector 0. card don't have MAD or don't have MAD on default keys");
got_first = false; got_first = false;
} else {
PrintAndLogEx(INFO, "Authentication ( " _GREEN_("OK") " )");
} }
// User supplied key // User supplied key
if (got_first == false && keylen == 6) { if (got_first == false && keylen == 6) {
if (mfReadSector(MF_MAD1_SECTOR, MF_KEY_A, userkey, sector0)) { PrintAndLogEx(INFO, "Trying user specified key...");
if (mfReadSector(MF_MAD1_SECTOR, MF_KEY_A, userkey, sector0) != PM3_SUCCESS) {
PrintAndLogEx(ERR, "error, read sector 0. card don't have MAD or don't the custom key is wrong"); PrintAndLogEx(ERR, "error, read sector 0. card don't have MAD or don't the custom key is wrong");
} else { } else {
PrintAndLogEx(INFO, "Authentication ( " _GREEN_("OK") " )");
got_first = true; got_first = true;
} }
} }
@ -4903,11 +4907,6 @@ static int CmdHF14AMfMAD(const char *Cmd) {
return PM3_ESOFT; return PM3_ESOFT;
} }
// if (aidlen != 2 && !decodeholder) {
// PrintAndLogEx(WARNING, "Using default MAD keys instead");
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(INFO, "--- " _CYAN_("MIFARE App Directory Information") " ----------------"); PrintAndLogEx(INFO, "--- " _CYAN_("MIFARE App Directory Information") " ----------------");
PrintAndLogEx(INFO, "-----------------------------------------------------"); PrintAndLogEx(INFO, "-----------------------------------------------------");