Merge branch 'RfidResearchGroup:master' into master

This commit is contained in:
Alex 2023-06-19 19:52:25 +02:00 committed by GitHub
commit 4dcde5e6fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 8 deletions

View file

@ -551,19 +551,19 @@ int saveFileJSONex(const char *preferredName, JSONFileType ftype, uint8_t *data,
if (atslen > 0)
JsonSaveBufAsHexCompact(root, "$.Card.ATS", &data[14], atslen);
uint8_t vdata[2][64][16 + 1] = {{{0}}};
memcpy(vdata, &data[14 + atslen], 2 * 64 * 17);
uint8_t vdata[2][64][17] = {{{0}}};
memcpy(vdata, data + (14 + atslen), 2 * 64 * 17);
for (size_t i = 0; i < datalen; i++) {
char path[PATH_MAX_LENGTH] = {0};
if (vdata[0][i][0]) {
snprintf(path, sizeof(path), "$.SectorKeys.%d.KeyA", mfSectorNum(i));
snprintf(path, sizeof(path), "$.SectorKeys.%zu.KeyA", i);
JsonSaveBufAsHexCompact(root, path, &vdata[0][i][1], 16);
}
if (vdata[1][i][0]) {
snprintf(path, sizeof(path), "$.SectorKeys.%d.KeyB", mfSectorNum(i));
snprintf(path, sizeof(path), "$.SectorKeys.%zu.KeyB", i);
JsonSaveBufAsHexCompact(root, path, &vdata[1][i][1], 16);
}
}

View file

@ -331,12 +331,22 @@ int MAD1DecodeAndPrint(uint8_t *sector, bool swapmad, bool verbose, bool *haveMA
for (int i = 1; i < 16; i++) {
uint16_t aid = madGetAID(sector, swapmad, 1, i);
if (aid < 6) {
PrintAndLogEx(INFO, (ibs == i) ? _MAGENTA_(" %02d [%04X] (%s)") : " %02d [%04X] (%s)", i, aid, aid_admin[aid]);
PrintAndLogEx(INFO,
(ibs == i) ? _MAGENTA_(" %02d [%04X] %s") : " %02d [" _GREEN_("%04X") "] %s",
i,
aid,
aid_admin[aid]
);
} else if (prev_aid == aid) {
PrintAndLogEx(INFO, (ibs == i) ? _MAGENTA_(" %02d [%04X] (continuation)") : " %02d [%04X] (continuation)", i, aid);
PrintAndLogEx(INFO,
(ibs == i) ? _MAGENTA_(" %02d [%04X] continuation") : " %02d [" _YELLOW_("%04X") "] continuation",
i,
aid
);
} else {
char fmt[30];
snprintf(fmt, sizeof(fmt), (ibs == i) ? _MAGENTA_(" %02d [%04X]%s") : " %02d [%04X]%s", i, aid, "%s");
char fmt[60];
snprintf(fmt, sizeof(fmt), (ibs == i) ? _MAGENTA_(" %02d [%04X]%s") : " %02d [" _GREEN_("%04X") "]%s", i, aid, "%s");
print_aid_description(mad_known_aids, aid, fmt, verbose);
prev_aid = aid;
}