making a 14a select fct reachable, in order to do a test in desfire code without repeating same ftc

This commit is contained in:
iceman1001 2021-04-30 11:18:14 +02:00
commit 0d1f8ca957
3 changed files with 19 additions and 2 deletions

View file

@ -843,7 +843,7 @@ int ExchangeRAW14a(uint8_t *datain, int datainlen, bool activateField, bool leav
return 0;
}
static int SelectCard14443_4(bool disconnect, iso14a_card_select_t *card) {
int SelectCard14443_4(bool disconnect, iso14a_card_select_t *card) {
PacketResponseNG resp;
frameLength = 0;
@ -862,7 +862,7 @@ static int SelectCard14443_4(bool disconnect, iso14a_card_select_t *card) {
// check result
if (resp.oldarg[0] == 0) {
PrintAndLogEx(ERR, "No card in fiel.");
PrintAndLogEx(ERR, "No card in field");
return PM3_ECARDEXCHANGE;
}

View file

@ -34,4 +34,5 @@ int Hf14443_4aGetCardData(iso14a_card_select_t *card);
int ExchangeAPDU14a(uint8_t *datain, int datainlen, bool activateField, bool leaveSignalON, uint8_t *dataout, int maxdataoutlen, int *dataoutlen);
int ExchangeRAW14a(uint8_t *datain, int datainlen, bool activateField, bool leaveSignalON, uint8_t *dataout, int maxdataoutlen, int *dataoutlen, bool silentMode);
int SelectCard14443_4(bool disconnect, iso14a_card_select_t *card);
#endif

View file

@ -3604,6 +3604,22 @@ static int CmdHF14ADesInfo(const char *Cmd) {
}
PrintAndLogEx(INFO, "-------------------------------------------------------------");
}
iso14a_card_select_t card;
res = SelectCard14443_4(true, &card);
if (res == PM3_SUCCESS) {
static const char STANDALONE_DESFIRE[] = { 0x75, 0x77, 0x81, 0x02};
static const char JCOP_DESFIRE[] = { 0x75, 0xf7, 0xb1, 0x02 };
if (str_startswith((const char*)card.ats + 1, STANDALONE_DESFIRE)) {
PrintAndLogEx(INFO, "Standalone DESFire");
}
if (str_startswith((const char*)card.ats + 1, JCOP_DESFIRE)) {
PrintAndLogEx(INFO, "JCOP DESFire");
}
}
/*
Card Master key (CMK) 0x00 AID = 00 00 00 (card level)
Application Master Key (AMK) 0x00 AID != 00 00 00