ATS printing can be an issue since some magic cards doesnt treat ATS properly. This will lessen the garbage output

This commit is contained in:
iceman1001 2024-09-13 13:42:34 +02:00
commit 65cf65dc96
3 changed files with 20 additions and 6 deletions

View file

@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file.
This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log... This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log...
## [unreleased][unreleased] ## [unreleased][unreleased]
- Changed `hf mf info` - Better handling when printing ATS (@iceman1001)
- Changed to also try the MFC_B key when extracting memory (@iceman1001) - Changed to also try the MFC_B key when extracting memory (@iceman1001)
- Fix parallel `make -j check` Thanks @elboulangero (@iceman1001) - Fix parallel `make -j check` Thanks @elboulangero (@iceman1001)
- Added support for 8268/8310 (@douniwan5788) - Added support for 8268/8310 (@douniwan5788)

View file

@ -7555,9 +7555,9 @@ static int CmdHF14AMfWipe(const char *Cmd) {
char *fptr; char *fptr;
if (keyfnlen == 0) { if (keyfnlen == 0) {
fptr = GenerateFilename("hf-mf-", "-key.bin"); fptr = GenerateFilename("hf-mf-", "-key.bin");
if (fptr == NULL) if (fptr == NULL) {
return PM3_ESOFT; return PM3_ESOFT;
}
strncpy(keyFilename, fptr, sizeof(keyFilename) - 1); strncpy(keyFilename, fptr, sizeof(keyFilename) - 1);
free(fptr); free(fptr);
} }
@ -7585,7 +7585,7 @@ static int CmdHF14AMfWipe(const char *Cmd) {
} }
case (MIFARE_1K_EV1_MAX_KEY_SIZE): { case (MIFARE_1K_EV1_MAX_KEY_SIZE): {
PrintAndLogEx(INFO, "Loaded keys matching MIFARE Classic 1K Ev1"); PrintAndLogEx(INFO, "Loaded keys matching MIFARE Classic 1K Ev1");
memcpy(keyA, keys, MIFARE_1K_EV1_MAXSECTOR * MIFARE_KEY_SIZE); memcpy(keyA, keys, (MIFARE_1K_EV1_MAXSECTOR * MIFARE_KEY_SIZE));
memcpy(keyB, keys + (MIFARE_1K_EV1_MAXSECTOR * MIFARE_KEY_SIZE), (MIFARE_1K_EV1_MAXSECTOR * MIFARE_KEY_SIZE)); memcpy(keyB, keys + (MIFARE_1K_EV1_MAXSECTOR * MIFARE_KEY_SIZE), (MIFARE_1K_EV1_MAXSECTOR * MIFARE_KEY_SIZE));
num_sectors = NumOfSectors('1'); num_sectors = NumOfSectors('1');
memcpy(mf, "\x11\x22\x33\x44\x44\x08\x04\x00\x62\x63\x64\x65\x66\x67\x68\x69", MFBLOCK_SIZE); memcpy(mf, "\x11\x22\x33\x44\x44\x08\x04\x00\x62\x63\x64\x65\x66\x67\x68\x69", MFBLOCK_SIZE);
@ -7863,14 +7863,27 @@ static int parse_gtu_cfg(uint8_t *d, size_t n) {
break; break;
} }
PrintAndLogEx(INFO, "..............%02X unknown", d[7]); uint8_t atslen = d[7];
if (atslen == 0) {
PrintAndLogEx(INFO, "..............%02X ATS length %u bytes ( %s )", _YELLOW_("zero"), atslen);
} else if (atslen <= 16) {
PrintAndLogEx(INFO, "..............%02X ATS length %u bytes ( %s )", _GREEN_("ok"), atslen);
} else {
PrintAndLogEx(INFO, "..............%02X ATS length %u bytes ( %s )", _RED_("fail"), atslen);
atslen = 0;
}
PrintAndLogEx(INFO, ""); PrintAndLogEx(INFO, "");
// ATS seems to have 16 bytes reserved // ATS seems to have 16 bytes reserved
PrintAndLogEx(INFO, _CYAN_("Config 2 - ATS")); PrintAndLogEx(INFO, _CYAN_("Config 2 - ATS"));
PrintAndLogEx(INFO, "%s", sprint_hex_inrow(d + 8, 16)); PrintAndLogEx(INFO, "%s", sprint_hex_inrow(d + 8, 16));
if (atslen <= 16) {
PrintAndLogEx(INFO, "%s.............. ATS ( %d bytes )", sprint_hex_inrow(&d[8], d[7]), d[7]); PrintAndLogEx(INFO, "%s.............. ATS ( %d bytes )", sprint_hex_inrow(&d[8], d[7]), d[7]);
PrintAndLogEx(INFO, "..................%s Reserved for ATS", sprint_hex_inrow(d + 8 + d[7], 16 - d[7])); PrintAndLogEx(INFO, "..................%s Reserved for ATS", sprint_hex_inrow(d + 8 + d[7], 16 - d[7]));
} else {
PrintAndLogEx(INFO, "%s.............. %s Reserved for ATS", sprint_hex_inrow(&d[8], 16), 16);
}
PrintAndLogEx(INFO, ""); PrintAndLogEx(INFO, "");
PrintAndLogEx(INFO, _CYAN_("Config 3 - Limits")); PrintAndLogEx(INFO, _CYAN_("Config 3 - Limits"));