detect desfire rudimentary

This commit is contained in:
iceman1001 2024-02-03 16:58:03 +01:00
commit 8f896940b0

View file

@ -479,6 +479,29 @@ static int CmdHfIctCredential(const char *Cmd) {
bool verbose = arg_get_lit(ctx, 5);
CLIParserFree(ctx);
SetAPDULogging(false);
DropField();
iso14a_card_select_t card;
if (ict_select_card(&card) != PM3_SUCCESS) {
return PM3_ESOFT;
}
bool isdesfire = false;
if ((card.sak & 0x24) == 0x24) {
isdesfire = true;
} else if ((card.sak & 0x20) == 0x20) {
if (card.atqa[0] == 0x003&& card.atqa[1] == 0x40) {
isdesfire = true;
}
}
if (isdesfire) {
// read file in desfire application
// add decrypt sector
} else {
uint16_t sc_size = mfNumBlocksPerSector(ICT_MIFARE_SECTOR) * MFBLOCK_SIZE;
uint8_t *data = calloc(sc_size, sizeof(uint8_t));
if (data == NULL) {
@ -503,6 +526,7 @@ static int CmdHfIctCredential(const char *Cmd) {
// add decrypt sector
free(data);
}
return PM3_SUCCESS;
}