mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
textual detection
This commit is contained in:
parent
b09c0e0d5f
commit
c860bd252a
4 changed files with 151 additions and 52 deletions
|
@ -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...
|
||||
|
||||
## [unreleased][unreleased]
|
||||
- Changed `hf mfp info` to identify Ev2 (@iceman1001)
|
||||
- Updated Graph Markers implementation to include temporary markers and marker labels (@HACKhalo2)
|
||||
- Updated to SWIG 4.2.1 (@iceman1001)
|
||||
- Removed `data bin2hex` - replaced by `data num` (@iceman1001)
|
||||
|
|
|
@ -245,27 +245,31 @@ static char *getProtocolStr(uint8_t id, bool hw) {
|
|||
return buf;
|
||||
}
|
||||
|
||||
static char *getVersionStr(uint8_t major, uint8_t minor) {
|
||||
static char *getVersionStr(uint8_t type, uint8_t major, uint8_t minor) {
|
||||
|
||||
static char buf[40] = {0x00};
|
||||
char *retStr = buf;
|
||||
|
||||
if (major == 0x00)
|
||||
snprintf(retStr, sizeof(buf), "%x.%x ( " _GREEN_("DESFire MF3ICD40") " )", major, minor);
|
||||
else if (major == 0x01 && minor == 0x00)
|
||||
snprintf(retStr, sizeof(buf), "%x.%x ( " _GREEN_("DESFire EV1") " )", major, minor);
|
||||
else if (major == 0x12 && minor == 0x00)
|
||||
snprintf(retStr, sizeof(buf), "%x.%x ( " _GREEN_("DESFire EV2") " )", major, minor);
|
||||
else if (major == 0x22 && minor == 0x00)
|
||||
snprintf(retStr, sizeof(buf), "%x.%x ( " _GREEN_("DESFire EV2 XL") " )", major, minor);
|
||||
else if (major == 0x42 && minor == 0x00)
|
||||
snprintf(retStr, sizeof(buf), "%x.%x ( " _GREEN_("DESFire EV2") " )", major, minor);
|
||||
else if (major == 0x33 && minor == 0x00)
|
||||
snprintf(retStr, sizeof(buf), "%x.%x ( " _GREEN_("DESFire EV3") " )", major, minor);
|
||||
else if (major == 0x30 && minor == 0x00)
|
||||
snprintf(retStr, sizeof(buf), "%x.%x ( " _GREEN_("DESFire Light") " )", major, minor);
|
||||
else if (major == 0x10 && minor == 0x00)
|
||||
snprintf(retStr, sizeof(buf), "%x.%x ( " _GREEN_("NTAG413DNA") " )", major, minor);
|
||||
else if (type == 0x01 && major == 0x01 && minor == 0x00)
|
||||
snprintf(retStr, sizeof(buf), "%x.%x ( " _GREEN_("DESFire EV1") " )", major, minor);
|
||||
else if (type == 0x01 && major == 0x12 && minor == 0x00)
|
||||
snprintf(retStr, sizeof(buf), "%x.%x ( " _GREEN_("DESFire EV2") " )", major, minor);
|
||||
else if (type == 0x01 && major == 0x22 && minor == 0x00)
|
||||
snprintf(retStr, sizeof(buf), "%x.%x ( " _GREEN_("DESFire EV2 XL") " )", major, minor);
|
||||
else if (type == 0x01 && major == 0x42 && minor == 0x00)
|
||||
snprintf(retStr, sizeof(buf), "%x.%x ( " _GREEN_("DESFire EV2") " )", major, minor);
|
||||
else if (type == 0x01 && major == 0x33 && minor == 0x00)
|
||||
snprintf(retStr, sizeof(buf), "%x.%x ( " _GREEN_("DESFire EV3") " )", major, minor);
|
||||
else if (type == 0x01 && major == 0x30 && minor == 0x00)
|
||||
snprintf(retStr, sizeof(buf), "%x.%x ( " _GREEN_("DESFire Light") " )", major, minor);
|
||||
else if (type == 0x02 && major == 0x11 && minor == 0x00)
|
||||
snprintf(retStr, sizeof(buf), "%x.%x ( " _GREEN_("Plus EV1") " )", major, minor);
|
||||
else if (type == 0x02 && major == 0x22 && minor == 0x00)
|
||||
snprintf(retStr, sizeof(buf), "%x.%x ( " _GREEN_("Plus EV2") " )", major, minor);
|
||||
else
|
||||
snprintf(retStr, sizeof(buf), "%x.%x ( " _YELLOW_("Unknown") " )", major, minor);
|
||||
return buf;
|
||||
|
@ -273,6 +277,31 @@ static char *getVersionStr(uint8_t major, uint8_t minor) {
|
|||
//04 01 01 01 00 1A 05
|
||||
}
|
||||
|
||||
static char *getTypeStr(uint8_t type) {
|
||||
|
||||
static char buf[40] = {0x00};
|
||||
char *retStr = buf;
|
||||
|
||||
switch (type) {
|
||||
case 1:
|
||||
snprintf(retStr, sizeof(buf), "0x%02X ( " _YELLOW_("DESFire") " )", type);
|
||||
break;
|
||||
case 2:
|
||||
snprintf(retStr, sizeof(buf), "0x%02X ( " _YELLOW_("Plus") " )", type);
|
||||
break;
|
||||
case 3:
|
||||
snprintf(retStr, sizeof(buf), "0x%02X ( " _YELLOW_("Ultralight") " )", type);
|
||||
break;
|
||||
case 4:
|
||||
snprintf(retStr, sizeof(buf), "0x%02X ( " _YELLOW_("NTAG") " )", type);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
static char noCommentStr[1] = { 0x00 };
|
||||
static const char *getAidCommentStr(uint8_t *aid) {
|
||||
for (int i = 0; i < ARRAYLEN(commonAids); i++) {
|
||||
|
@ -283,28 +312,46 @@ static const char *getAidCommentStr(uint8_t *aid) {
|
|||
return noCommentStr;
|
||||
}
|
||||
|
||||
static nxp_cardtype_t getCardType(uint8_t major, uint8_t minor) {
|
||||
static nxp_cardtype_t getCardType(uint8_t type, uint8_t major, uint8_t minor) {
|
||||
|
||||
if (major == 0x00)
|
||||
// DESFire MF3ICD40
|
||||
if (major == 0x00 && minor == 0x00)
|
||||
return DESFIRE_MF3ICD40;
|
||||
if (major == 0x01 && minor == 0x00)
|
||||
|
||||
// DESFire EV1
|
||||
if (type == 0x01 && major == 0x01 && minor == 0x00)
|
||||
return DESFIRE_EV1;
|
||||
if (major == 0x12 && minor == 0x00)
|
||||
|
||||
// DESFire EV2
|
||||
if (type == 0x01 && major == 0x12 && minor == 0x00)
|
||||
return DESFIRE_EV2;
|
||||
if (major == 0x22 && minor == 0x00)
|
||||
|
||||
if (type == 0x01 && major == 0x22 && minor == 0x00)
|
||||
return DESFIRE_EV2_XL;
|
||||
if (major == 0x42 && minor == 0x00)
|
||||
|
||||
if (type == 0x01 && major == 0x42 && minor == 0x00)
|
||||
return DESFIRE_EV2;
|
||||
if (major == 0x33 && minor == 0x00)
|
||||
|
||||
// DESFire EV3
|
||||
if (type == 0x01 && major == 0x33 && minor == 0x00)
|
||||
return DESFIRE_EV3;
|
||||
if (major == 0x30 && minor == 0x00)
|
||||
|
||||
// DESFire Light
|
||||
if (type == 0x01 && major == 0x30 && minor == 0x00)
|
||||
return DESFIRE_LIGHT;
|
||||
if (major == 0x11 && minor == 0x00)
|
||||
|
||||
// Plus EV1
|
||||
if (type == 0x02 && major == 0x11 && minor == 0x00)
|
||||
return PLUS_EV1;
|
||||
if (major == 0x22 && minor == 0x00)
|
||||
|
||||
// Plus Ev2
|
||||
if (type == 0x02 && major == 0x22 && minor == 0x00)
|
||||
return PLUS_EV2;
|
||||
|
||||
// NTAG 413 DNA
|
||||
if (major == 0x10 && minor == 0x00)
|
||||
return NTAG413DNA;
|
||||
|
||||
return DESFIRE_UNKNOWN;
|
||||
}
|
||||
|
||||
|
@ -660,7 +707,7 @@ static int CmdHF14ADesInfo(const char *Cmd) {
|
|||
return res;
|
||||
}
|
||||
|
||||
nxp_cardtype_t cardtype = getCardType(info.versionHW[3], info.versionHW[4]);
|
||||
nxp_cardtype_t cardtype = getCardType(info.versionHW[1], info.versionHW[3], info.versionHW[4]);
|
||||
if (cardtype == PLUS_EV1) {
|
||||
PrintAndLogEx(INFO, "Card seems to be MIFARE Plus EV1. Try " _YELLOW_("`hf mfp info`"));
|
||||
DropField();
|
||||
|
@ -671,7 +718,13 @@ static int CmdHF14ADesInfo(const char *Cmd) {
|
|||
DropField();
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
if (cardtype == DESFIRE_UNKNOWN) {
|
||||
PrintAndLogEx(INFO, "HW Version.. %s", sprint_hex_inrow(info.versionHW, sizeof(info.versionHW)));
|
||||
PrintAndLogEx(INFO, "SW Version.. %s", sprint_hex_inrow(info.versionSW, sizeof(info.versionSW)));
|
||||
PrintAndLogEx(INFO, "Version data identification failed. Report to Iceman!");
|
||||
DropField();
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(INFO, "---------------------------------- " _CYAN_("Tag Information") " ----------------------------------");
|
||||
|
@ -689,16 +742,16 @@ static int CmdHF14ADesInfo(const char *Cmd) {
|
|||
PrintAndLogEx(INFO, " raw: %s", sprint_hex_inrow(info.versionHW, sizeof(info.versionHW)));
|
||||
|
||||
PrintAndLogEx(INFO, " Vendor Id: " _YELLOW_("%s"), getTagInfo(info.versionHW[0]));
|
||||
PrintAndLogEx(INFO, " Type: " _YELLOW_("0x%02X"), info.versionHW[1]);
|
||||
PrintAndLogEx(INFO, " Type: %s", getTypeStr(info.versionHW[1]));
|
||||
PrintAndLogEx(INFO, " Subtype: " _YELLOW_("0x%02X"), info.versionHW[2]);
|
||||
PrintAndLogEx(INFO, " Version: %s", getVersionStr(info.versionHW[3], info.versionHW[4]));
|
||||
PrintAndLogEx(INFO, " Version: %s", getVersionStr(info.versionHW[1], info.versionHW[3], info.versionHW[4]));
|
||||
PrintAndLogEx(INFO, " Storage size: %s", getCardSizeStr(info.versionHW[5]));
|
||||
PrintAndLogEx(INFO, " Protocol: %s", getProtocolStr(info.versionHW[6], true));
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(INFO, "--- " _CYAN_("Software Information"));
|
||||
PrintAndLogEx(INFO, " raw: %s", sprint_hex_inrow(info.versionSW, sizeof(info.versionSW)));
|
||||
PrintAndLogEx(INFO, " Vendor Id: " _YELLOW_("%s"), getTagInfo(info.versionSW[0]));
|
||||
PrintAndLogEx(INFO, " Type: " _YELLOW_("0x%02X"), info.versionSW[1]);
|
||||
PrintAndLogEx(INFO, " Type: %s", getTypeStr(info.versionSW[1]));
|
||||
PrintAndLogEx(INFO, " Subtype: " _YELLOW_("0x%02X"), info.versionSW[2]);
|
||||
PrintAndLogEx(INFO, " Version: " _YELLOW_("%d.%d"), info.versionSW[3], info.versionSW[4]);
|
||||
PrintAndLogEx(INFO, " Storage size: %s", getCardSizeStr(info.versionSW[5]));
|
||||
|
|
|
@ -83,23 +83,31 @@ static char *getProtocolStr(uint8_t id, bool hw) {
|
|||
return buf;
|
||||
}
|
||||
|
||||
static char *getVersionStr(uint8_t major, uint8_t minor) {
|
||||
static char *getVersionStr(uint8_t type, uint8_t major, uint8_t minor) {
|
||||
|
||||
static char buf[40] = {0x00};
|
||||
char *retStr = buf;
|
||||
|
||||
if (major == 0x00)
|
||||
snprintf(retStr, sizeof(buf), "%x.%x ( " _GREEN_("DESFire MF3ICD40") " )", major, minor);
|
||||
else if (major == 0x01 && minor == 0x00)
|
||||
else if (major == 0x10 && minor == 0x00)
|
||||
snprintf(retStr, sizeof(buf), "%x.%x ( " _GREEN_("NTAG413DNA") " )", major, minor);
|
||||
else if (type == 0x01 && major == 0x01 && minor == 0x00)
|
||||
snprintf(retStr, sizeof(buf), "%x.%x ( " _GREEN_("DESFire EV1") " )", major, minor);
|
||||
else if (major == 0x12 && minor == 0x00)
|
||||
else if (type == 0x01 && major == 0x12 && minor == 0x00)
|
||||
snprintf(retStr, sizeof(buf), "%x.%x ( " _GREEN_("DESFire EV2") " )", major, minor);
|
||||
else if (major == 0x33 && minor == 0x00)
|
||||
else if (type == 0x01 && major == 0x22 && minor == 0x00)
|
||||
snprintf(retStr, sizeof(buf), "%x.%x ( " _GREEN_("DESFire EV2 XL") " )", major, minor);
|
||||
else if (type == 0x01 && major == 0x42 && minor == 0x00)
|
||||
snprintf(retStr, sizeof(buf), "%x.%x ( " _GREEN_("DESFire EV2") " )", major, minor);
|
||||
else if (type == 0x01 && major == 0x33 && minor == 0x00)
|
||||
snprintf(retStr, sizeof(buf), "%x.%x ( " _GREEN_("DESFire EV3") " )", major, minor);
|
||||
else if (major == 0x30 && minor == 0x00)
|
||||
else if (type == 0x01 && major == 0x30 && minor == 0x00)
|
||||
snprintf(retStr, sizeof(buf), "%x.%x ( " _GREEN_("DESFire Light") " )", major, minor);
|
||||
else if (major == 0x11 && minor == 0x00)
|
||||
else if (type == 0x02 && major == 0x11 && minor == 0x00)
|
||||
snprintf(retStr, sizeof(buf), "%x.%x ( " _GREEN_("Plus EV1") " )", major, minor);
|
||||
else if (type == 0x02 && major == 0x22 && minor == 0x00)
|
||||
snprintf(retStr, sizeof(buf), "%x.%x ( " _GREEN_("Plus EV2") " )", major, minor);
|
||||
else
|
||||
snprintf(retStr, sizeof(buf), "%x.%x ( " _YELLOW_("Unknown") " )", major, minor);
|
||||
return buf;
|
||||
|
@ -129,35 +137,46 @@ static char *getTypeStr(uint8_t type) {
|
|||
return buf;
|
||||
}
|
||||
|
||||
static nxp_cardtype_t getCardType(uint8_t major, uint8_t minor) {
|
||||
static nxp_cardtype_t getCardType(uint8_t type, uint8_t major, uint8_t minor) {
|
||||
|
||||
// DESFire MF3ICD40
|
||||
if (major == 0x00 && minor == 0x00)
|
||||
return DESFIRE_MF3ICD40;
|
||||
|
||||
// DESFire EV1
|
||||
if (major == 0x01 && minor == 0x00)
|
||||
if (type == 0x01 && major == 0x01 && minor == 0x00)
|
||||
return DESFIRE_EV1;
|
||||
|
||||
// DESFire EV2
|
||||
if (major == 0x12 && minor == 0x00)
|
||||
if (type == 0x01 && major == 0x12 && minor == 0x00)
|
||||
return DESFIRE_EV2;
|
||||
|
||||
if (type == 0x01 && major == 0x22 && minor == 0x00)
|
||||
return DESFIRE_EV2_XL;
|
||||
|
||||
if (type == 0x01 && major == 0x42 && minor == 0x00)
|
||||
return DESFIRE_EV2;
|
||||
|
||||
// DESFire EV3
|
||||
if (major == 0x33 && minor == 0x00)
|
||||
if (type == 0x01 && major == 0x33 && minor == 0x00)
|
||||
return DESFIRE_EV3;
|
||||
|
||||
// DESFire Light
|
||||
if (major == 0x30 && minor == 0x00)
|
||||
if (type == 0x01 && major == 0x30 && minor == 0x00)
|
||||
return DESFIRE_LIGHT;
|
||||
|
||||
// Plus EV1
|
||||
if (major == 0x11 && minor == 0x00)
|
||||
if (type == 0x02 && major == 0x11 && minor == 0x00)
|
||||
return PLUS_EV1;
|
||||
|
||||
if (major == 0x22 && minor == 0x00)
|
||||
// Plus Ev2
|
||||
if (type == 0x02 && major == 0x22 && minor == 0x00)
|
||||
return PLUS_EV2;
|
||||
|
||||
// NTAG 413 DNA
|
||||
if (major == 0x10 && minor == 0x00)
|
||||
return NTAG413DNA;
|
||||
|
||||
return MFP_UNKNOWN;
|
||||
}
|
||||
|
||||
|
@ -244,7 +263,7 @@ static int plus_print_version(uint8_t *version) {
|
|||
PrintAndLogEx(INFO, " Vendor Id: " _YELLOW_("%s"), getTagInfo(version[0]));
|
||||
PrintAndLogEx(INFO, " Type: %s", getTypeStr(version[1]));
|
||||
PrintAndLogEx(INFO, " Subtype: " _YELLOW_("0x%02X"), version[2]);
|
||||
PrintAndLogEx(INFO, " Version: %s", getVersionStr(version[3], version[4]));
|
||||
PrintAndLogEx(INFO, " Version: %s", getVersionStr(version[1], version[3], version[4]));
|
||||
PrintAndLogEx(INFO, " Storage size: %s", getCardSizeStr(version[5]));
|
||||
PrintAndLogEx(INFO, " Protocol: %s", getProtocolStr(version[6], true));
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
|
@ -327,17 +346,41 @@ static int CmdHFMFPInfo(const char *Cmd) {
|
|||
|
||||
if (supportVersion) {
|
||||
|
||||
int cardtype = getCardType(version[3], version[4]);
|
||||
|
||||
if (cardtype == 6) {
|
||||
if (supportSignature) {
|
||||
PrintAndLogEx(INFO, " Tech...... " _GREEN_("MIFARE Plus EV1"));
|
||||
} else {
|
||||
PrintAndLogEx(INFO, " Tech...... " _YELLOW_("MIFARE Plus SE/X"));
|
||||
int cardtype = getCardType(version[1], version[3], version[4]);
|
||||
switch(cardtype) {
|
||||
case PLUS_EV1: {
|
||||
if (supportSignature) {
|
||||
PrintAndLogEx(INFO, " Tech...... " _GREEN_("MIFARE Plus EV1"));
|
||||
} else {
|
||||
PrintAndLogEx(INFO, " Tech...... " _YELLOW_("MIFARE Plus SE/X"));
|
||||
}
|
||||
isPlus = true;
|
||||
break;
|
||||
}
|
||||
case PLUS_EV2: {
|
||||
if (supportSignature) {
|
||||
PrintAndLogEx(INFO, " Tech...... " _GREEN_("MIFARE Plus EV2"));
|
||||
} else {
|
||||
PrintAndLogEx(INFO, " Tech...... " _YELLOW_("MIFARE Plus EV2 ???"));
|
||||
}
|
||||
isPlus = true;
|
||||
break;
|
||||
}
|
||||
case DESFIRE_MF3ICD40:
|
||||
case DESFIRE_EV1:
|
||||
case DESFIRE_EV2:
|
||||
case DESFIRE_EV2_XL:
|
||||
case DESFIRE_EV3:
|
||||
case DESFIRE_LIGHT: {
|
||||
PrintAndLogEx(HINT, "Card seems to be MIFARE DESFire. Try " _YELLOW_("`hf mfdes info`"));
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
DropField();
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
default: {
|
||||
PrintAndLogEx(INFO, " Tech...... Unknown ( " _YELLOW_("%u") " )", cardtype);
|
||||
break;
|
||||
}
|
||||
isPlus = true;
|
||||
} else {
|
||||
PrintAndLogEx(INFO, " Tech...... Unknown ( " _YELLOW_("%u") " )", cardtype);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,10 +25,12 @@ typedef enum {
|
|||
DESFIRE_MF3ICD40,
|
||||
DESFIRE_EV1,
|
||||
DESFIRE_EV2,
|
||||
DESFIRE_EV2_XL,
|
||||
DESFIRE_EV3,
|
||||
DESFIRE_LIGHT,
|
||||
PLUS_EV1,
|
||||
PLUS_EV2,
|
||||
NTAG413DNA
|
||||
} nxp_cardtype_t;
|
||||
|
||||
typedef struct mfp_key_item {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue