// try to see if card responses to "chinese magic backdoor" commands.
- c.cmd = CMD_MIFARE_CIDENT;
- c.arg[0] = 0;
- c.arg[1] = 0;
- c.arg[2] = 0;
- SendCommand(&c);
- WaitForResponse(CMD_ACK,&resp);
+ mfCIdentify();
- uint8_t isGeneration = resp.arg[0] & 0xff;
- switch( isGeneration ){
- case 1: PrintAndLog("Answers to chinese magic backdoor commands (GEN 1a): YES"); break;
- case 2: PrintAndLog("Answers to chinese magic backdoor commands (GEN 1b): YES"); break;
- default: PrintAndLog("Answers to chinese magic backdoor commands: NO"); break;
- }
-
- // disconnect
- c.cmd = CMD_READER_ISO_14443a;
- c.arg[0] = 0;
- c.arg[1] = 0;
- c.arg[2] = 0;
- SendCommand(&c);
-
return select_status;
}
// repeat n times
for (int i = 0; i < n; i++) {
// execute anticollision procedure
- UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_CONNECT, 0, 0}};
+ UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_CONNECT | ISO14A_NO_RATS, 0, 0}};
SendCommand(&c);
UsbCommand resp;
return 0;
}
+int CmdHF14AAPDU(const char *cmd) {
+ if (strlen(cmd)<2) {
+ PrintAndLog("Usage: hf 14a apdu [-s] [-k] [-t] <APDU (hex)>");
+ PrintAndLog(" -s activate field and select card");
+ PrintAndLog(" -k leave the signal field ON after receive response");
+ PrintAndLog(" -t executes TLV decoder if it possible");
+ return 0;
+ }
+
+
+
+ return 0;
+}
int CmdHF14ACmdRaw(const char *cmd) {
UsbCommand c = {CMD_READER_ISO_14443a, {0, 0, 0}};
bool power = false;
bool active = false;
bool active_select = false;
+ bool no_rats = false;
uint16_t numbits = 0;
bool bTimeout = false;
uint32_t timeout = 0;
PrintAndLog(" -b number of bits to send. Useful for send partial byte");
PrintAndLog(" -t timeout in ms");
PrintAndLog(" -T use Topaz protocol to send command");
+ PrintAndLog(" -3 ISO14443-3 select only (skip RATS)");
return 0;
}
case 'T':
topazmode = true;
break;
+ case '3':
+ no_rats = true;
+ break;
default:
PrintAndLog("Invalid option");
return 0;
c.arg[0] |= ISO14A_TOPAZMODE;
}
+ if(no_rats) {
+ c.arg[0] |= ISO14A_NO_RATS;
+ }
+
// Max buffer is USB_CMD_DATA_SIZE (512)
c.arg[1] = (datalen & 0xFFFF) | ((uint32_t)numbits << 16);
memcpy(c.d.asBytes,data,datalen);
{"cuids", CmdHF14ACUIDs, 0, "<n> Collect n>0 ISO14443 Type A UIDs in one go"},
{"sim", CmdHF14ASim, 0, "<UID> -- Simulate ISO 14443a tag"},
{"snoop", CmdHF14ASnoop, 0, "Eavesdrop ISO 14443 Type A"},
+ {"apdu", CmdHF14AAPDU, 0, "Send ISO 1443-4 APDU to tag"},
{"raw", CmdHF14ACmdRaw, 0, "Send raw hex data to tag"},
{NULL, NULL, 0, NULL}
};