Fix display of DF and minor bug

This commit is contained in:
Bjoern Kerler 2020-04-07 21:52:59 +02:00
commit 7085e3a3f1

View file

@ -358,16 +358,16 @@ static int get_desfire_dfnames(dfname_t *dest, uint8_t* dfname_count) {
int ret = SendDesfireCmd(c, sizeof(c), INIT, sizeof(c), 0, &resp, 3000);
if (ret != PM3_SUCCESS) return ret;
uint8_t count=0;
memcpy(&dest[count], resp.data.asBytes+1, resp.length - 5);
uint8_t count = 1;
memcpy(&dest[count - 1], resp.data.asBytes + 1, resp.length - 5);
if (resp.data.asBytes[resp.length - 3] == MFDES_ADDITIONAL_FRAME) {
c[0] = MFDES_ADDITIONAL_FRAME; //0xAF
ret = SendDesfireCmd(c, sizeof(c), NONE, sizeof(c), 0, &resp, 3000);
if (ret != PM3_SUCCESS) return ret;
count++;
memcpy(&dest[count], resp.data.asBytes+1, resp.length - 5);
memcpy(&dest[count - 1], resp.data.asBytes + 1, resp.length - 5);
}
*dfname_count=count-1;
*dfname_count = count;
return PM3_SUCCESS;
}
@ -712,8 +712,7 @@ static int CmdHF14ADesEnumApplications(const char *Cmd) {
return PM3_ESOFT;
}
if (get_desfire_dfnames(dfnames,&dfname_count)!=PM3_SUCCESS)
{
if (get_desfire_dfnames(dfnames, &dfname_count) != PM3_SUCCESS) {
PrintAndLogEx(WARNING, _RED_("Can't get DF Names"));
DropField();
return PM3_ESOFT;
@ -735,15 +734,15 @@ static int CmdHF14ADesEnumApplications(const char *Cmd) {
if (memcmp(aid, "\x00\x00\x00", 3) == 0) {
// CARD MASTER KEY
PrintAndLogEx(INFO, "--- " _CYAN_("CMK - PICC, Card Master Key settings"));
}
else {
} else {
PrintAndLogEx(SUCCESS, "--- " _CYAN_("AMK - Application Master Key settings"));
}
if (i<dfname_count) {
PrintAndLogEx(SUCCESS, " AID : " _GREEN_("%02X %02X %02X"), aid[0], aid[1], aid[2]);
} else {
PrintAndLogEx(SUCCESS, " AID : " _GREEN_("%02X %02X %02X") " - Name : " _YELLOW_("%s"), aid[0], aid[1], aid[2], dfnames[i/3].name);
for (int m = 0; m < dfname_count; m++) {
if (dfnames[m].aid[0] == aid[0] && dfnames[m].aid[1] == aid[1] && dfnames[m].aid[2] == aid[2]) {
PrintAndLogEx(SUCCESS, " - DF " _YELLOW_("%02X %02X") " Name : " _YELLOW_("%s"), dfnames[m].fid[0], dfnames[m].fid[1], dfnames[m].name);
}
}
getKeySettings(aid);