mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-24 15:15:39 -07:00
anticollision instead of select aid=0, printfilesettings formatting fix
This commit is contained in:
parent
48da8970b1
commit
220749eebe
2 changed files with 26 additions and 10 deletions
|
@ -887,14 +887,25 @@ int DesfireSelectAndAuthenticateEx(DesfireContext *dctx, DesfireSecureChannel se
|
||||||
if (verbose)
|
if (verbose)
|
||||||
PrintAndLogEx(INFO, "Switch to " _CYAN_("native") " for select");
|
PrintAndLogEx(INFO, "Switch to " _CYAN_("native") " for select");
|
||||||
}
|
}
|
||||||
|
|
||||||
int res = DesfireSelectAIDHex(dctx, aid, false, 0);
|
int res;
|
||||||
if (res != PM3_SUCCESS) {
|
if (aid == 0x000000) {
|
||||||
PrintAndLogEx(ERR, "Desfire select " _RED_("error") ".");
|
res = DesfireAnticollision(verbose);
|
||||||
return 200;
|
if (res != PM3_SUCCESS) {
|
||||||
|
PrintAndLogEx(ERR, "Desfire anticollision " _RED_("error") ".");
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
if (verbose)
|
||||||
|
PrintAndLogEx(INFO, "Anticollision " _GREEN_("ok"));
|
||||||
|
} else {
|
||||||
|
res = DesfireSelectAIDHex(dctx, aid, false, 0);
|
||||||
|
if (res != PM3_SUCCESS) {
|
||||||
|
PrintAndLogEx(ERR, "Desfire select " _RED_("error") ".");
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
if (verbose)
|
||||||
|
PrintAndLogEx(INFO, "App %06x " _GREEN_("selected"), aid);
|
||||||
}
|
}
|
||||||
if (verbose)
|
|
||||||
PrintAndLogEx(INFO, "App %06x " _GREEN_("selected"), aid);
|
|
||||||
|
|
||||||
if (isosw)
|
if (isosw)
|
||||||
dctx->cmdSet = DCCISO;
|
dctx->cmdSet = DCCISO;
|
||||||
|
@ -2219,8 +2230,8 @@ void DesfirePrintFileSettingsOneLine(FileSettingsS *fsettings) {
|
||||||
|
|
||||||
void DesfirePrintFileSettingsTable(bool printheader, uint8_t id, bool isoidavail, uint16_t isoid, FileSettingsS *fsettings) {
|
void DesfirePrintFileSettingsTable(bool printheader, uint8_t id, bool isoidavail, uint16_t isoid, FileSettingsS *fsettings) {
|
||||||
if (printheader) {
|
if (printheader) {
|
||||||
PrintAndLogEx(SUCCESS, " ID |ISO ID| File type | Mode | Rights: raw, r w rw ch | File settings ");
|
PrintAndLogEx(SUCCESS, " ID |ISO ID| File type | Mode | Rights: raw, r w rw ch | File settings ");
|
||||||
PrintAndLogEx(SUCCESS, "----------------------------------------------------------------------------------------------------------");
|
PrintAndLogEx(SUCCESS, "------------------------------------------------------------------------------------------------------------");
|
||||||
}
|
}
|
||||||
PrintAndLogEx(SUCCESS, " " _GREEN_("%02x") " |" NOLF, id);
|
PrintAndLogEx(SUCCESS, " " _GREEN_("%02x") " |" NOLF, id);
|
||||||
if (isoidavail) {
|
if (isoidavail) {
|
||||||
|
@ -2232,7 +2243,7 @@ void DesfirePrintFileSettingsTable(bool printheader, uint8_t id, bool isoidavail
|
||||||
PrintAndLogEx(NORMAL, " |" NOLF);
|
PrintAndLogEx(NORMAL, " |" NOLF);
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintAndLogEx(NORMAL, "0x%02x " _CYAN_("%-13s") " |" NOLF, fsettings->fileType, GetDesfireFileType(fsettings->fileType));
|
PrintAndLogEx(NORMAL, "0x%02x " _CYAN_("%-15s") " |" NOLF, fsettings->fileType, GetDesfireFileType(fsettings->fileType));
|
||||||
PrintAndLogEx(NORMAL, " %-5s |" NOLF, GetDesfireCommunicationMode(fsettings->fileCommMode));
|
PrintAndLogEx(NORMAL, " %-5s |" NOLF, GetDesfireCommunicationMode(fsettings->fileCommMode));
|
||||||
|
|
||||||
PrintAndLogEx(NORMAL, "%04x, %-4s %-4s %-4s %-4s |" NOLF,
|
PrintAndLogEx(NORMAL, "%04x, %-4s %-4s %-4s %-4s |" NOLF,
|
||||||
|
@ -2728,6 +2739,10 @@ int DesfireGetCardUID(DesfireContext *ctx) {
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int DesfireAnticollision(bool verbose) {
|
||||||
|
return SelectCard14443A_4(false, verbose, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
int DesfireSelectEx(DesfireContext *ctx, bool fieldon, DesfireISOSelectWay way, uint32_t id, char *dfname) {
|
int DesfireSelectEx(DesfireContext *ctx, bool fieldon, DesfireISOSelectWay way, uint32_t id, char *dfname) {
|
||||||
uint8_t resp[250] = {0};
|
uint8_t resp[250] = {0};
|
||||||
size_t resplen = 0;
|
size_t resplen = 0;
|
||||||
|
|
|
@ -161,6 +161,7 @@ int DesfireExchangeEx(bool activate_field, DesfireContext *ctx, uint8_t cmd, uin
|
||||||
|
|
||||||
int DesfireReadSignature(DesfireContext *dctx, uint8_t sid, uint8_t *resp, size_t *resplen);
|
int DesfireReadSignature(DesfireContext *dctx, uint8_t sid, uint8_t *resp, size_t *resplen);
|
||||||
|
|
||||||
|
int DesfireAnticollision(bool verbose);
|
||||||
int DesfireSelectAID(DesfireContext *ctx, uint8_t *aid1, uint8_t *aid2);
|
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);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue