textual
This commit is contained in:
@@ -4499,6 +4499,7 @@ static int CmdHF14AMfMAD(const char *Cmd) {
|
||||
arg_str0("aA", "aid", "print all sectors with specified aid", NULL),
|
||||
arg_str0("kK", "key", "key for printing sectors", NULL),
|
||||
arg_lit0("bB", "keyb", "use key B for access printing sectors (by default: key A)"),
|
||||
arg_lit0("", "be", "(optional, try BigEndian"),
|
||||
arg_param_end
|
||||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
@@ -4510,23 +4511,25 @@ static int CmdHF14AMfMAD(const char *Cmd) {
|
||||
int keylen;
|
||||
CLIGetHexWithReturn(ctx, 3, key, &keylen);
|
||||
bool keyB = arg_get_lit(4);
|
||||
// bool use_be = arg_get_lit(5);
|
||||
|
||||
CLIParserFree(ctx);
|
||||
|
||||
if (aidlen != 2 && keylen > 0) {
|
||||
PrintAndLogEx(WARNING, "do not need a key without aid.");
|
||||
PrintAndLogEx(WARNING, "do not need a key without aid");
|
||||
}
|
||||
|
||||
uint8_t sector0[16 * 4] = {0};
|
||||
uint8_t sector10[16 * 4] = {0};
|
||||
if (mfReadSector(MF_MAD1_SECTOR, MF_KEY_A, (uint8_t *)g_mifare_mad_key, sector0)) {
|
||||
PrintAndLogEx(ERR, "read sector 0 error. card don't have MAD or don't have MAD on default keys.");
|
||||
PrintAndLogEx(ERR, "error, read sector 0. card don't have MAD or don't have MAD on default keys");
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
if (verbose) {
|
||||
PrintAndLogEx(SUCCESS, "Raw:");
|
||||
for (int i = 0; i < 4; i ++)
|
||||
PrintAndLogEx(NORMAL, "[%d] %s", i, sprint_hex(§or0[i * 16], 16));
|
||||
PrintAndLogEx(INFO, "[%d] %s", i, sprint_hex(§or0[i * 16], 16));
|
||||
}
|
||||
|
||||
bool haveMAD2 = false;
|
||||
@@ -4534,7 +4537,7 @@ static int CmdHF14AMfMAD(const char *Cmd) {
|
||||
|
||||
if (haveMAD2) {
|
||||
if (mfReadSector(MF_MAD2_SECTOR, MF_KEY_A, (uint8_t *)g_mifare_mad_key, sector10)) {
|
||||
PrintAndLogEx(ERR, "read sector 0x10 error. card don't have MAD or don't have MAD on default keys.");
|
||||
PrintAndLogEx(ERR, "error, read sector 0x10. card don't have MAD or don't have MAD on default keys");
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
@@ -4548,7 +4551,7 @@ static int CmdHF14AMfMAD(const char *Cmd) {
|
||||
uint16_t mad[7 + 8 + 8 + 8 + 8] = {0};
|
||||
size_t madlen = 0;
|
||||
if (MADDecode(sector0, sector10, mad, &madlen)) {
|
||||
PrintAndLogEx(ERR, "can't decode mad.");
|
||||
PrintAndLogEx(ERR, "can't decode MAD");
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
@@ -4563,7 +4566,7 @@ static int CmdHF14AMfMAD(const char *Cmd) {
|
||||
uint8_t vsector[16 * 4] = {0};
|
||||
if (mfReadSector(i + 1, keyB ? MF_KEY_B : MF_KEY_A, akey, vsector)) {
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(ERR, "read sector %d error.", i + 1);
|
||||
PrintAndLogEx(ERR, "error, read sector %d", i + 1);
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user