mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2024-09-20 23:36:31 +08:00
Add detection and info command behavior for NTAG 5 devices, enable EAS status check in info command for SLI, SLIX, SLIX-L, and SLIX-S tags which all support EAS mode
(cherry picked from commit a430439f05654fe62c365f4c8f5ee13cb4103dfa)
This commit is contained in:
parent
c364a6821c
commit
8bbc5934b5
|
@ -99,6 +99,7 @@ static const productName_t uidmapping[] = {
|
||||||
//I-Code SLIX-L [IC id = 03 + bit36 set to 1]
|
//I-Code SLIX-L [IC id = 03 + bit36 set to 1]
|
||||||
{ 0xE004000000000000LL, 16, "NXP Semiconductors Germany (Philips)" },
|
{ 0xE004000000000000LL, 16, "NXP Semiconductors Germany (Philips)" },
|
||||||
{ 0xE004010000000000LL, 24, "NXP(Philips); IC SL2 ICS20/ICS21(SLI) ICS2002/ICS2102(SLIX) ICS2602(SLIX2)" },
|
{ 0xE004010000000000LL, 24, "NXP(Philips); IC SL2 ICS20/ICS21(SLI) ICS2002/ICS2102(SLIX) ICS2602(SLIX2)" },
|
||||||
|
{ 0xE004011800000000LL, 0xFFFFFF1800000000LL, "NXP(Philips); IC NTP53x2/NTP5210/NTA5332(NTAG 5)" },
|
||||||
{ 0xE004010000000000LL, 0xFFFFFF1800000000LL, "NXP(Philips); IC SL2 ICS20/ICS21(SLI)" },
|
{ 0xE004010000000000LL, 0xFFFFFF1800000000LL, "NXP(Philips); IC SL2 ICS20/ICS21(SLI)" },
|
||||||
{ 0xE004011000000000LL, 0xFFFFFF1800000000LL, "NXP(Philips); IC SL2 ICS2002/ICS2102(SLIX)" },
|
{ 0xE004011000000000LL, 0xFFFFFF1800000000LL, "NXP(Philips); IC SL2 ICS2002/ICS2102(SLIX)" },
|
||||||
{ 0xE004010800000000LL, 0xFFFFFF1800000000LL, "NXP(Philips); IC SL2 ICS2602(SLIX2)" },
|
{ 0xE004010800000000LL, 0xFFFFFF1800000000LL, "NXP(Philips); IC SL2 ICS2602(SLIX2)" },
|
||||||
|
@ -651,6 +652,95 @@ static int CmdHF15Samples(const char *Cmd) {
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int NxpTestEAS(uint8_t *uid)
|
||||||
|
{
|
||||||
|
uint8_t fast = 1;
|
||||||
|
uint8_t reply = 1;
|
||||||
|
PacketResponseNG resp;
|
||||||
|
uint16_t reqlen = 0;
|
||||||
|
uint8_t req[PM3_CMD_DATA_SIZE] = {0};
|
||||||
|
|
||||||
|
req[reqlen++] |= ISO15_REQ_SUBCARRIER_SINGLE | ISO15_REQ_DATARATE_HIGH | ISO15_REQ_NONINVENTORY | ISO15_REQ_ADDRESS;
|
||||||
|
req[reqlen++] = ISO15693_EAS_ALARM;
|
||||||
|
req[reqlen++] = 0x04; // IC manufacturer code
|
||||||
|
memcpy(req + 3, uid, 8); // add UID
|
||||||
|
reqlen += 8;
|
||||||
|
|
||||||
|
AddCrc15(req, reqlen);
|
||||||
|
reqlen += 2;
|
||||||
|
|
||||||
|
clearCommandBuffer();
|
||||||
|
SendCommandMIX(CMD_HF_ISO15693_COMMAND, reqlen, fast, reply, req, reqlen);
|
||||||
|
|
||||||
|
if (WaitForResponseTimeout(CMD_HF_ISO15693_COMMAND, &resp, 2000) == false) {
|
||||||
|
PrintAndLogEx(WARNING, "iso15693 timeout");
|
||||||
|
} else {
|
||||||
|
PrintAndLogEx(NORMAL, "");
|
||||||
|
|
||||||
|
|
||||||
|
if (resp.length < 2) {
|
||||||
|
PrintAndLogEx(INFO, " EAS (Electronic Article Surveillance) is not active");
|
||||||
|
} else {
|
||||||
|
uint8_t * recv = resp.data.asBytes;
|
||||||
|
|
||||||
|
if (!(recv[0] & ISO15_RES_ERROR)) {
|
||||||
|
PrintAndLogEx(INFO, " EAS (Electronic Article Surveillance) is active.");
|
||||||
|
PrintAndLogEx(INFO, " EAS sequence: %s", sprint_hex(recv + 1, 32));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return PM3_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int NxpCheckSig(uint8_t *uid) {
|
||||||
|
uint8_t fast = 1;
|
||||||
|
uint8_t reply = 1;
|
||||||
|
PacketResponseNG resp;
|
||||||
|
uint16_t reqlen = 0;
|
||||||
|
uint8_t req[PM3_CMD_DATA_SIZE] = {0};
|
||||||
|
|
||||||
|
// Check if we can also read the signature
|
||||||
|
req[reqlen++] |= ISO15_REQ_SUBCARRIER_SINGLE | ISO15_REQ_DATARATE_HIGH | ISO15_REQ_NONINVENTORY | ISO15_REQ_ADDRESS;
|
||||||
|
req[reqlen++] = ISO15693_READ_SIGNATURE;
|
||||||
|
req[reqlen++] = 0x04; // IC manufacturer code
|
||||||
|
memcpy(req + 3, uid, 8); // add UID
|
||||||
|
reqlen += 8;
|
||||||
|
|
||||||
|
AddCrc15(req, reqlen);
|
||||||
|
reqlen += 2;
|
||||||
|
|
||||||
|
clearCommandBuffer();
|
||||||
|
SendCommandMIX(CMD_HF_ISO15693_COMMAND, reqlen, fast, reply, req, reqlen);
|
||||||
|
|
||||||
|
if (WaitForResponseTimeout(CMD_HF_ISO15693_COMMAND, &resp, 2000) == false) {
|
||||||
|
PrintAndLogEx(WARNING, "iso15693 timeout");
|
||||||
|
DropField();
|
||||||
|
return PM3_ETIMEOUT;
|
||||||
|
}
|
||||||
|
|
||||||
|
DropField();
|
||||||
|
|
||||||
|
if (resp.length < 2) {
|
||||||
|
PrintAndLogEx(WARNING, "iso15693 card doesn't answer to READ SIGNATURE command");
|
||||||
|
return PM3_EWRONGANSWER;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t *recv = resp.data.asBytes;
|
||||||
|
|
||||||
|
if ((recv[0] & ISO15_RES_ERROR) == ISO15_RES_ERROR) {
|
||||||
|
PrintAndLogEx(ERR, "iso15693 card returned error %i: %s", recv[0], TagErrorStr(recv[0]));
|
||||||
|
return PM3_EWRONGANSWER;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t signature[32] = {0x00};
|
||||||
|
memcpy(signature, recv + 1, 32);
|
||||||
|
|
||||||
|
nxp_15693_print_signature(uid, signature);
|
||||||
|
|
||||||
|
return PM3_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
// Get NXP system information from SLIX2 tag/VICC
|
// Get NXP system information from SLIX2 tag/VICC
|
||||||
static int NxpSysInfo(uint8_t *uid) {
|
static int NxpSysInfo(uint8_t *uid) {
|
||||||
|
|
||||||
|
@ -732,77 +822,11 @@ static int NxpSysInfo(uint8_t *uid) {
|
||||||
PrintAndLogEx(INFO, " * Additional 32 bits feature flags are%s transmitted", ((recv[5] & 0x80) ? "" : " not"));
|
PrintAndLogEx(INFO, " * Additional 32 bits feature flags are%s transmitted", ((recv[5] & 0x80) ? "" : " not"));
|
||||||
|
|
||||||
if (support_easmode) {
|
if (support_easmode) {
|
||||||
reqlen = 0;
|
NxpTestEAS(uid);
|
||||||
req[reqlen++] |= ISO15_REQ_SUBCARRIER_SINGLE | ISO15_REQ_DATARATE_HIGH | ISO15_REQ_NONINVENTORY | ISO15_REQ_ADDRESS;
|
|
||||||
req[reqlen++] = ISO15693_EAS_ALARM;
|
|
||||||
req[reqlen++] = 0x04; // IC manufacturer code
|
|
||||||
memcpy(req + 3, uid, 8); // add UID
|
|
||||||
reqlen += 8;
|
|
||||||
|
|
||||||
AddCrc15(req, reqlen);
|
|
||||||
reqlen += 2;
|
|
||||||
|
|
||||||
clearCommandBuffer();
|
|
||||||
SendCommandMIX(CMD_HF_ISO15693_COMMAND, reqlen, fast, reply, req, reqlen);
|
|
||||||
|
|
||||||
if (WaitForResponseTimeout(CMD_HF_ISO15693_COMMAND, &resp, 2000) == false) {
|
|
||||||
PrintAndLogEx(WARNING, "iso15693 timeout");
|
|
||||||
} else {
|
|
||||||
PrintAndLogEx(NORMAL, "");
|
|
||||||
|
|
||||||
|
|
||||||
if (resp.length < 2) {
|
|
||||||
PrintAndLogEx(INFO, " EAS (Electronic Article Surveillance) is not active");
|
|
||||||
} else {
|
|
||||||
recv = resp.data.asBytes;
|
|
||||||
|
|
||||||
if (!(recv[0] & ISO15_RES_ERROR)) {
|
|
||||||
PrintAndLogEx(INFO, " EAS (Electronic Article Surveillance) is active.");
|
|
||||||
PrintAndLogEx(INFO, " EAS sequence: %s", sprint_hex(recv + 1, 32));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (support_signature) {
|
if (support_signature) {
|
||||||
// Check if we can also read the signature
|
NxpCheckSig(uid);
|
||||||
reqlen = 0;
|
|
||||||
req[reqlen++] |= ISO15_REQ_SUBCARRIER_SINGLE | ISO15_REQ_DATARATE_HIGH | ISO15_REQ_NONINVENTORY | ISO15_REQ_ADDRESS;
|
|
||||||
req[reqlen++] = ISO15693_READ_SIGNATURE;
|
|
||||||
req[reqlen++] = 0x04; // IC manufacturer code
|
|
||||||
memcpy(req + 3, uid, 8); // add UID
|
|
||||||
reqlen += 8;
|
|
||||||
|
|
||||||
AddCrc15(req, reqlen);
|
|
||||||
reqlen += 2;
|
|
||||||
|
|
||||||
clearCommandBuffer();
|
|
||||||
SendCommandMIX(CMD_HF_ISO15693_COMMAND, reqlen, fast, reply, req, reqlen);
|
|
||||||
|
|
||||||
if (WaitForResponseTimeout(CMD_HF_ISO15693_COMMAND, &resp, 2000) == false) {
|
|
||||||
PrintAndLogEx(WARNING, "iso15693 timeout");
|
|
||||||
DropField();
|
|
||||||
return PM3_ETIMEOUT;
|
|
||||||
}
|
|
||||||
|
|
||||||
DropField();
|
|
||||||
|
|
||||||
if (resp.length < 2) {
|
|
||||||
PrintAndLogEx(WARNING, "iso15693 card doesn't answer to READ SIGNATURE command");
|
|
||||||
return PM3_EWRONGANSWER;
|
|
||||||
}
|
|
||||||
|
|
||||||
recv = resp.data.asBytes;
|
|
||||||
|
|
||||||
if ((recv[0] & ISO15_RES_ERROR) == ISO15_RES_ERROR) {
|
|
||||||
PrintAndLogEx(ERR, "iso15693 card returned error %i: %s", recv[0], TagErrorStr(recv[0]));
|
|
||||||
return PM3_EWRONGANSWER;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t signature[32] = {0x00};
|
|
||||||
memcpy(signature, recv + 1, 32);
|
|
||||||
|
|
||||||
nxp_15693_print_signature(uid, signature);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
|
@ -945,6 +969,16 @@ static int CmdHF15Info(const char *Cmd) {
|
||||||
PrintAndLogEx(DEBUG, "SLIX2 Detected, getting NXP System Info");
|
PrintAndLogEx(DEBUG, "SLIX2 Detected, getting NXP System Info");
|
||||||
return NxpSysInfo(uid);
|
return NxpSysInfo(uid);
|
||||||
}
|
}
|
||||||
|
else if(data[8] == 0x04 && data[7] == 0x01 && nxp_version == 0x18) //If it is an NTAG 5
|
||||||
|
{
|
||||||
|
PrintAndLogEx(DEBUG, "NTAG 5 Detected, getting NXP System Info");
|
||||||
|
return NxpSysInfo(uid);
|
||||||
|
}
|
||||||
|
else if(data[8] == 0x04 && (data[7] == 0x01 || data[7] == 0x02 || data[7] == 0x03)) //If SLI, SLIX, SLIX-l, or SLIX-S check EAS status
|
||||||
|
{
|
||||||
|
PrintAndLogEx(DEBUG, "SLI, SLIX, SLIX-L, or SLIX-S Detected checking EAS status");
|
||||||
|
return NxpTestEAS(uid);
|
||||||
|
}
|
||||||
|
|
||||||
PrintAndLogEx(NORMAL, "");
|
PrintAndLogEx(NORMAL, "");
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
|
|
Loading…
Reference in a new issue