mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-02-25 08:35:56 +08:00
Merge pull request #651 from bkerler/improve_14a_info
Add NTAG handling, fix TNP3xxx, remove ISO 14443-B card uids
This commit is contained in:
commit
6926c412f6
2 changed files with 43 additions and 47 deletions
|
@ -3,8 +3,9 @@ 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]
|
||||||
|
- Improved `hf 14a info` - card detection handling (@bkerler)
|
||||||
- Updated helptext layout in all luascripts (@iceman1001)
|
- Updated helptext layout in all luascripts (@iceman1001)
|
||||||
- Change `hf mfdes info` - output and logging (@brkeler)
|
- Change `hf mfdes info` - output and logging (@bkerler)
|
||||||
- Updated texts in legic commands (@ikarus23)
|
- Updated texts in legic commands (@ikarus23)
|
||||||
- Fix timing bug inside 40x5 (@mwalker33)
|
- Fix timing bug inside 40x5 (@mwalker33)
|
||||||
- Refactored all Hitag2 attacks (@doegox)
|
- Refactored all Hitag2 attacks (@doegox)
|
||||||
|
|
|
@ -1251,84 +1251,89 @@ static void printTag(char *tag) {
|
||||||
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
mtNone = 0,
|
MTNONE = 0,
|
||||||
mtClassic = 1,
|
MTCLASSIC = 1,
|
||||||
mtMini = 2,
|
MTMINI = 2,
|
||||||
mtDESFire = 4,
|
MTDESFIRE = 4,
|
||||||
mtPlus = 8,
|
MTPLUS = 8,
|
||||||
mtUltralight = 16,
|
MTULTRALIGHT = 16,
|
||||||
mtOther = 32
|
MTOTHER = 32
|
||||||
} nxp_mifare_type;
|
} nxp_mifare_type_t;
|
||||||
|
|
||||||
// According to NXP AN10833 Rev 3.6 MIFARE Type Identification, Table 6
|
// According to NXP AN10833 Rev 3.6 MIFARE Type Identification, Table 6
|
||||||
int detect_nxp_card(uint8_t sak, uint16_t atqa) {
|
int detect_nxp_card(uint8_t sak, uint16_t atqa) {
|
||||||
int type = mtNone;
|
int type = MTNONE;
|
||||||
|
|
||||||
if (sak == 0x00) {
|
if (sak == 0x00) {
|
||||||
|
printTag("NTAG 21x / NTAG 21x TT / NTAG I2C plus");
|
||||||
printTag("MIFARE Ultralight C / Ultralight CL2");
|
printTag("MIFARE Ultralight C / Ultralight CL2");
|
||||||
type = mtUltralight;
|
type = MTULTRALIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sak == 0x01) {
|
if (sak == 0x01) {
|
||||||
printTag("TNP3xxx (Activision Game Appliance)");
|
printTag("TNP3xxx (Activision Game Appliance)");
|
||||||
type = mtOther;
|
type = MTCLASSIC;
|
||||||
}
|
}
|
||||||
if ((sak & 0x04) == 0x04) {
|
if ((sak & 0x04) == 0x04) {
|
||||||
printTag("Any MIFARE CL1");
|
printTag("Any MIFARE CL1 / NTAG424DNA");
|
||||||
type |= mtDESFire;
|
type |= MTDESFIRE;
|
||||||
}
|
}
|
||||||
if ((sak & 0x08) == 0x08) {
|
if ((sak & 0x08) == 0x08) {
|
||||||
printTag("MIFARE Classic 1K / Classic 1K CL2");
|
printTag("MIFARE Classic 1K / Classic 1K CL2");
|
||||||
printTag("MIFARE Plus 2K / Plus EV1 2K");
|
printTag("MIFARE Plus 2K / Plus EV1 2K");
|
||||||
printTag("MIFARE Plus CL2 2K / Plus CL2 EV1 2K");
|
printTag("MIFARE Plus CL2 2K / Plus CL2 EV1 2K");
|
||||||
type |= mtClassic;
|
type |= MTCLASSIC;
|
||||||
type |= mtPlus;
|
type |= MTPLUS;
|
||||||
}
|
}
|
||||||
if ((sak & 0x09) == 0x09) {
|
if ((sak & 0x09) == 0x09) {
|
||||||
printTag("MIFARE Mini 0.3K / Mini CL2 0.3K");
|
printTag("MIFARE Mini 0.3K / Mini CL2 0.3K");
|
||||||
type |= mtMini;
|
type |= MTMINI;
|
||||||
}
|
}
|
||||||
if ((sak & 0x10) == 0x10) {
|
if ((sak & 0x10) == 0x10) {
|
||||||
printTag("MIFARE Plus 2K / Plus CL2 2K");
|
printTag("MIFARE Plus 2K / Plus CL2 2K");
|
||||||
type |= mtPlus;
|
type |= MTPLUS;
|
||||||
}
|
}
|
||||||
if ((sak & 0x11) == 0x11) {
|
if ((sak & 0x11) == 0x11) {
|
||||||
printTag("MIFARE Plus 4K / Plus CL2 4K");
|
printTag("MIFARE Plus 4K / Plus CL2 4K");
|
||||||
type |= mtPlus;
|
type |= MTPLUS;
|
||||||
}
|
}
|
||||||
if ((sak & 0x18) == 0x18) {
|
if ((sak & 0x18) == 0x18) {
|
||||||
if (atqa == 0x0042) {
|
if (atqa == 0x0042) {
|
||||||
printTag("MIFARE Plus 4K / Plus EV1 4K");
|
printTag("MIFARE Plus 4K / Plus EV1 4K");
|
||||||
printTag("MIFARE Plus CL2 4K / Plus CL2 EV1 4K");
|
printTag("MIFARE Plus CL2 4K / Plus CL2 EV1 4K");
|
||||||
type |= mtPlus;
|
type |= MTPLUS;
|
||||||
} else {
|
} else {
|
||||||
printTag("MIFARE Classic 4K / Classic 4K CL2");
|
printTag("MIFARE Classic 4K / Classic 4K CL2");
|
||||||
type |= mtClassic;
|
type |= MTCLASSIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if ((sak & 0x20) == 0x20) {
|
if ((sak & 0x20) == 0x20) {
|
||||||
if (atqa == 0x0344) {
|
if (atqa == 0x0344) {
|
||||||
printTag("MIFARE DESFire EV1 2K/4K/8K / DESFire EV1 CL2 2K/4K/8K");
|
printTag("MIFARE DESFire EV1 2K/4K/8K / DESFire EV1 CL2 2K/4K/8K");
|
||||||
type |= mtDESFire;
|
printTag("MIFARE NTAG424DNA");
|
||||||
|
type |= MTDESFIRE;
|
||||||
|
} else if (atqa == 0x0304) {
|
||||||
|
printTag("MIFARE NTAG424DNA (Random ID feature)");
|
||||||
|
type |= MTDESFIRE;
|
||||||
} else {
|
} else {
|
||||||
printTag("MIFARE Plus 2K / Plus EV1 2K");
|
printTag("MIFARE Plus 2K / Plus EV1 2K");
|
||||||
printTag("MIFARE Plus 4K / Plus EV1 4K");
|
printTag("MIFARE Plus 4K / Plus EV1 4K");
|
||||||
printTag("MIFARE Plus CL2 2K / Plus CL2 EV1 4K");
|
printTag("MIFARE Plus CL2 2K / Plus CL2 EV1 4K");
|
||||||
printTag("MIFARE Plus CL2 4K / Plus CL2 EV1 4K");
|
printTag("MIFARE Plus CL2 4K / Plus CL2 EV1 4K");
|
||||||
type |= mtPlus;
|
type |= MTPLUS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((sak & 0x24) == 0x24) {
|
if ((sak & 0x24) == 0x24) {
|
||||||
if (atqa == 0x0344) {
|
if (atqa == 0x0344) {
|
||||||
printTag("MIFARE DESFire CL1 / DESFire EV1 CL1");
|
printTag("MIFARE DESFire CL1 / DESFire EV1 CL1");
|
||||||
type |= mtDESFire;
|
type |= MTDESFIRE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((sak & 0x28) == 0x28) {
|
if ((sak & 0x28) == 0x28) {
|
||||||
if (atqa == 0x0344) {
|
if (atqa == 0x0344) {
|
||||||
printTag("MIFARE DESFire CL1 / DESFire EV1 CL1");
|
printTag("MIFARE DESFire CL1 / DESFire EV1 CL1");
|
||||||
type |= mtDESFire;
|
type |= MTDESFIRE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return type;
|
return type;
|
||||||
|
@ -1342,16 +1347,6 @@ typedef struct {
|
||||||
|
|
||||||
const uidname uidmap[] = {
|
const uidname uidmap[] = {
|
||||||
// UID0, UID1, TEXT
|
// UID0, UID1, TEXT
|
||||||
{0x02, 0x00, "SR176"},
|
|
||||||
{0x02, 0x03, "SRIX4K"},
|
|
||||||
{0x02, 0x0C, "SRT512"},
|
|
||||||
{0x02, 0x0F, "SRI2K"},
|
|
||||||
{0x02, 0x1B, "25TB512-AC"},
|
|
||||||
{0x02, 0x3D, "SRIX4K"},
|
|
||||||
{0x02, 0x3F, "25TB02K"},
|
|
||||||
{0x02, 0x4D, "SRIX512"},
|
|
||||||
{0x02, 0x6D, "SRI512"},
|
|
||||||
{0x02, 0x7D, "SRI4K"},
|
|
||||||
{0x02, 0x84, "M24SR64-Y"},
|
{0x02, 0x84, "M24SR64-Y"},
|
||||||
{0x02, 0xA3, "25TA02KB-P"},
|
{0x02, 0xA3, "25TA02KB-P"},
|
||||||
{0x02, 0xC4, "25TA64K"},
|
{0x02, 0xC4, "25TA64K"},
|
||||||
|
@ -1422,22 +1417,22 @@ int infoHF14A(bool verbose, bool do_nack_test, bool do_aid_search) {
|
||||||
bool isMifareDESFire = false;
|
bool isMifareDESFire = false;
|
||||||
bool isMifarePlus = false;
|
bool isMifarePlus = false;
|
||||||
bool isMifareUltralight = false;
|
bool isMifareUltralight = false;
|
||||||
int nxptype = mtNone;
|
int nxptype = MTNONE;
|
||||||
// Double & triple sized UID, can be mapped to a manufacturer.
|
// Double & triple sized UID, can be mapped to a manufacturer.
|
||||||
if (card.uidlen <= 4) {
|
if (card.uidlen <= 4) {
|
||||||
nxptype = detect_nxp_card(card.sak, ((card.atqa[1] << 8) + card.atqa[0]));
|
nxptype = detect_nxp_card(card.sak, ((card.atqa[1] << 8) + card.atqa[0]));
|
||||||
if ((nxptype & mtClassic) == mtClassic) isMifareClassic = true;
|
if ((nxptype & MTCLASSIC) == MTCLASSIC) isMifareClassic = true;
|
||||||
else isMifareClassic = false;
|
else isMifareClassic = false;
|
||||||
if ((nxptype & mtDESFire) == mtDESFire) {
|
if ((nxptype & MTDESFIRE) == MTDESFIRE) {
|
||||||
isMifareDESFire = true;
|
isMifareDESFire = true;
|
||||||
} else {
|
} else {
|
||||||
isMifareDESFire = false;
|
isMifareDESFire = false;
|
||||||
}
|
}
|
||||||
if ((nxptype & mtPlus) == mtPlus) isMifarePlus = true;
|
if ((nxptype & MTPLUS) == MTPLUS) isMifarePlus = true;
|
||||||
else isMifarePlus = false;
|
else isMifarePlus = false;
|
||||||
if ((nxptype & mtUltralight) == mtUltralight) isMifareUltralight = true;
|
if ((nxptype & MTULTRALIGHT) == MTULTRALIGHT) isMifareUltralight = true;
|
||||||
else isMifareUltralight = false;
|
else isMifareUltralight = false;
|
||||||
if ((nxptype & mtOther) == mtOther) isMifareClassic = true;
|
if ((nxptype & MTOTHER) == MTOTHER) isMifareClassic = true;
|
||||||
}
|
}
|
||||||
if (card.uidlen > 4) {
|
if (card.uidlen > 4) {
|
||||||
PrintAndLogEx(SUCCESS, "MANUFACTURER: " _YELLOW_("%s"), getTagInfo(card.uid[0]));
|
PrintAndLogEx(SUCCESS, "MANUFACTURER: " _YELLOW_("%s"), getTagInfo(card.uid[0]));
|
||||||
|
@ -1446,18 +1441,18 @@ int infoHF14A(bool verbose, bool do_nack_test, bool do_aid_search) {
|
||||||
switch (card.uid[0]) {
|
switch (card.uid[0]) {
|
||||||
case 0x04: // NXP
|
case 0x04: // NXP
|
||||||
nxptype = detect_nxp_card(card.sak, ((card.atqa[1] << 8) + card.atqa[0]));
|
nxptype = detect_nxp_card(card.sak, ((card.atqa[1] << 8) + card.atqa[0]));
|
||||||
if ((nxptype & mtClassic) == mtClassic) isMifareClassic = true;
|
if ((nxptype & MTCLASSIC) == MTCLASSIC) isMifareClassic = true;
|
||||||
else isMifareClassic = false;
|
else isMifareClassic = false;
|
||||||
if ((nxptype & mtDESFire) == mtDESFire) {
|
if ((nxptype & MTDESFIRE) == MTDESFIRE) {
|
||||||
isMifareDESFire = true;
|
isMifareDESFire = true;
|
||||||
} else {
|
} else {
|
||||||
isMifareDESFire = false;
|
isMifareDESFire = false;
|
||||||
}
|
}
|
||||||
if ((nxptype & mtPlus) == mtPlus) isMifarePlus = true;
|
if ((nxptype & MTPLUS) == MTPLUS) isMifarePlus = true;
|
||||||
else isMifarePlus = false;
|
else isMifarePlus = false;
|
||||||
if ((nxptype & mtUltralight) == mtUltralight) isMifareUltralight = true;
|
if ((nxptype & MTULTRALIGHT) == MTULTRALIGHT) isMifareUltralight = true;
|
||||||
else isMifareUltralight = false;
|
else isMifareUltralight = false;
|
||||||
if ((nxptype & mtOther) == mtOther) isMifareClassic = true;
|
if ((nxptype & MTOTHER) == MTOTHER) isMifareClassic = true;
|
||||||
break;
|
break;
|
||||||
case 0x05: // Infineon
|
case 0x05: // Infineon
|
||||||
if ((card.uid[1] & 0xF0) == 0x10) {
|
if ((card.uid[1] & 0xF0) == 0x10) {
|
||||||
|
@ -1765,7 +1760,7 @@ int infoHF14A(bool verbose, bool do_nack_test, bool do_aid_search) {
|
||||||
PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`hf mfdes info`"));
|
PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`hf mfdes info`"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((card.sak & 0x08) == 0x08) || ((card.sak & 0x18) == 0x18)) {
|
if (isMifareClassic || isMifareUltralight) {
|
||||||
detect_classic_magic();
|
detect_classic_magic();
|
||||||
|
|
||||||
if (isMifareClassic) {
|
if (isMifareClassic) {
|
||||||
|
|
Loading…
Reference in a new issue