mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-03-19 19:38:52 +08:00
get card data
This commit is contained in:
parent
f8c33af1da
commit
e3aebd7985
2 changed files with 41 additions and 0 deletions
|
@ -190,6 +190,45 @@ int CmdHF14AList(const char *Cmd) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int Hf14443_4aGetCardData(iso14a_card_select_t * card) {
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_CONNECT, 0, 0}};
|
||||
SendCommand(&c);
|
||||
|
||||
UsbCommand resp;
|
||||
WaitForResponse(CMD_ACK,&resp);
|
||||
|
||||
memcpy(card, (iso14a_card_select_t *)resp.d.asBytes, sizeof(iso14a_card_select_t));
|
||||
|
||||
uint64_t select_status = resp.arg[0]; // 0: couldn't read, 1: OK, with ATS, 2: OK, no ATS, 3: proprietary Anticollision
|
||||
|
||||
if(select_status == 0) {
|
||||
PrintAndLog("E->iso14443a card select failed");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(select_status == 2) {
|
||||
PrintAndLog("E->Card doesn't support iso14443-4 mode");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(select_status == 3) {
|
||||
PrintAndLog("E->Card doesn't support standard iso14443-3 anticollision");
|
||||
PrintAndLog("\tATQA : %02x %02x", card->atqa[1], card->atqa[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
PrintAndLog(" UID: %s", sprint_hex(card->uid, card->uidlen));
|
||||
PrintAndLog("ATQA: %02x %02x", card->atqa[1], card->atqa[0]);
|
||||
PrintAndLog(" SAK: %02x [%" PRIu64 "]", card->sak, resp.arg[0]);
|
||||
if(card->ats_len < 3) { // a valid ATS consists of at least the length byte (TL) and 2 CRC bytes
|
||||
PrintAndLog("E-> Error ATS length(%d) : %s", card->ats_len, sprint_hex(card->ats, card->ats_len));
|
||||
return 1;
|
||||
}
|
||||
PrintAndLog(" ATS: %s", sprint_hex(card->ats, card->ats_len));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CmdHF14AReader(const char *Cmd) {
|
||||
|
||||
uint32_t cm = ISO14A_CONNECT;
|
||||
|
@ -875,6 +914,7 @@ int ExchangeAPDU14a(uint8_t *datain, int datainlen, bool activateField, bool lea
|
|||
return 0;
|
||||
}
|
||||
|
||||
// ISO14443-4. 7. Half-duplex block transmission protocol
|
||||
int CmdHF14AAPDU(const char *cmd) {
|
||||
uint8_t data[USB_CMD_DATA_SIZE];
|
||||
int datalen = 0;
|
||||
|
|
|
@ -50,6 +50,7 @@ extern int CmdHF14ACUIDs(const char *Cmd);
|
|||
extern int CmdHF14AAntiFuzz(const char *cmd);
|
||||
|
||||
extern char* getTagInfo(uint8_t uid);
|
||||
extern int Hf14443_4aGetCardData(iso14a_card_select_t * card);
|
||||
extern int ExchangeAPDU14a(uint8_t *datain, int datainlen, bool activateField, bool leaveSignalON, uint8_t *dataout, int maxdataoutlen, int *dataoutlen);
|
||||
extern int ExchangeRAW14a(uint8_t *datain, int datainlen, bool activateField, bool leaveSignalON, uint8_t *dataout, int maxdataoutlen, int *dataoutlen);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue