mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-25 07:35:40 -07:00
print mad app
This commit is contained in:
parent
82d0cc3dbf
commit
df20f2dbee
3 changed files with 57 additions and 5 deletions
|
@ -1600,12 +1600,46 @@ static int CmdHF14aDesMAD(const char *Cmd) {
|
||||||
AppListS AppList = {0};
|
AppListS AppList = {0};
|
||||||
DesfireFillAppList(&dctx, &PICCInfo, AppList, false, false); // no deep scan, no scan files
|
DesfireFillAppList(&dctx, &PICCInfo, AppList, false, false); // no deep scan, no scan files
|
||||||
|
|
||||||
|
if (PICCInfo.freemem == 0xffffffff)
|
||||||
|
PrintAndLogEx(SUCCESS, "Applications count: " _GREEN_("%zu") " free memory " _YELLOW_("n/a"), PICCInfo.appCount);
|
||||||
|
else
|
||||||
|
PrintAndLogEx(SUCCESS, "Applications count: " _GREEN_("%zu") " free memory " _GREEN_("%d") " bytes", PICCInfo.appCount, PICCInfo.freemem);
|
||||||
|
|
||||||
|
if ((PICCInfo.keySettings & (1 << 1)) == 0)
|
||||||
|
PrintAndLogEx(WARNING, "Directory list access with CMK : " _RED_("Enabled") ". Try to read mad with Card Master Key(");
|
||||||
|
|
||||||
// print zone
|
// print zone
|
||||||
DesfirePrintPICCInfo(&dctx, &PICCInfo);
|
PrintAndLogEx(SUCCESS, "------------------------------------ " _CYAN_("MAD") " -------------------------------------");
|
||||||
DesfirePrintAppList(&dctx, &PICCInfo, AppList);
|
bool foundFFFFFF = false;
|
||||||
|
for (int i = 0; i < PICCInfo.appCount; i++) {
|
||||||
|
if (AppList[i].appNum == 0xffffff) {
|
||||||
|
foundFFFFFF = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foundFFFFFF) {
|
||||||
|
res = DesfireSelectAIDHexNoFieldOn(&dctx, 0xffffff);
|
||||||
|
if (res == PM3_SUCCESS) {
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
PrintAndLogEx(WARNING, _RED_("Can't select") " issuer information app (0xffffff).");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
PrintAndLogEx(WARNING, "Issuer information " _RED_("not found") " on the card.");
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t madappcount = 0;
|
||||||
|
for (int i = 0; i < PICCInfo.appCount; i++) {
|
||||||
|
if ((AppList[i].appNum & 0xf00000) == 0xf00000) {
|
||||||
|
DesfirePrintMADAID(AppList[i].appNum, verbose);
|
||||||
|
madappcount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (madappcount == 0)
|
||||||
|
PrintAndLogEx(SUCCESS, "There is no MAD applications on the card");
|
||||||
|
|
||||||
DropField();
|
DropField();
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
|
|
|
@ -837,6 +837,23 @@ int DesfireSelectAIDHexNoFieldOn(DesfireContext *ctx, uint32_t aid) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DesfirePrintMADAID(uint32_t appid, bool verbose) {
|
||||||
|
uint8_t aid[3] = {0};
|
||||||
|
DesfireAIDUintToByte(appid, aid);
|
||||||
|
if ((aid[2] >> 4) != 0xF)
|
||||||
|
return;
|
||||||
|
|
||||||
|
uint16_t short_aid = ((aid[2] & 0xF) << 12) | (aid[1] << 4) | (aid[0] >> 4);
|
||||||
|
|
||||||
|
PrintAndLogEx(SUCCESS, "MIFARE Classic ID (MAD) " _YELLOW_("%04X") " AID %06x MAD AID Cluster 0x%02X " _YELLOW_("%s"),
|
||||||
|
short_aid,
|
||||||
|
appid,
|
||||||
|
short_aid >> 8,
|
||||||
|
nxp_cluster_to_text(short_aid >> 8));
|
||||||
|
if (verbose)
|
||||||
|
MADDFDecodeAndPrint(short_aid);
|
||||||
|
}
|
||||||
|
|
||||||
void DesfirePrintAIDFunctions(uint32_t appid) {
|
void DesfirePrintAIDFunctions(uint32_t appid) {
|
||||||
uint8_t aid[3] = {0};
|
uint8_t aid[3] = {0};
|
||||||
DesfireAIDUintToByte(appid, aid);
|
DesfireAIDUintToByte(appid, aid);
|
||||||
|
|
|
@ -165,6 +165,7 @@ int DesfireSelectAID(DesfireContext *ctx, uint8_t *aid1, uint8_t *aid2);
|
||||||
int DesfireSelectAIDHex(DesfireContext *ctx, uint32_t aid1, bool select_two, uint32_t aid2);
|
int DesfireSelectAIDHex(DesfireContext *ctx, uint32_t aid1, bool select_two, uint32_t aid2);
|
||||||
int DesfireSelectAIDHexNoFieldOn(DesfireContext *ctx, uint32_t aid);
|
int DesfireSelectAIDHexNoFieldOn(DesfireContext *ctx, uint32_t aid);
|
||||||
void DesfirePrintAIDFunctions(uint32_t appid);
|
void DesfirePrintAIDFunctions(uint32_t appid);
|
||||||
|
void DesfirePrintMADAID(uint32_t appid, bool verbose);
|
||||||
|
|
||||||
int DesfireGetCardUID(DesfireContext *ctx);
|
int DesfireGetCardUID(DesfireContext *ctx);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue