mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-22 22:23:38 -07:00
added command hf 14a info
, copy functionality from hf 14a reader
to hf 14a info
, added command hf 14a reader
with simple anticollision-select procedure
#447
This commit is contained in:
parent
3851172d81
commit
4ece69610f
1 changed files with 35 additions and 1 deletions
|
@ -133,7 +133,40 @@ int CmdHF14AList(const char *Cmd)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CmdHF14AReader(const char *Cmd)
|
int CmdHF14AReader(const char *Cmd) {
|
||||||
|
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_CONNECT, 0, 0}};
|
||||||
|
SendCommand(&c);
|
||||||
|
|
||||||
|
UsbCommand resp;
|
||||||
|
WaitForResponse(CMD_ACK,&resp);
|
||||||
|
|
||||||
|
iso14a_card_select_t card;
|
||||||
|
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("iso14443a card select failed");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(select_status == 3) {
|
||||||
|
PrintAndLog("Card doesn't support standard iso14443-3 anticollision");
|
||||||
|
PrintAndLog("ATQA : %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 [%d]", 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(" ATS : %s", sprint_hex(card.ats, card.ats_len));
|
||||||
|
}
|
||||||
|
PrintAndLog("For more info execute command `hf 14a info`");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CmdHF14AInfo(const char *Cmd)
|
||||||
{
|
{
|
||||||
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0}};
|
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0}};
|
||||||
SendCommand(&c);
|
SendCommand(&c);
|
||||||
|
@ -756,6 +789,7 @@ static command_t CommandTable[] =
|
||||||
{"help", CmdHelp, 1, "This help"},
|
{"help", CmdHelp, 1, "This help"},
|
||||||
{"list", CmdHF14AList, 0, "[Deprecated] List ISO 14443a history"},
|
{"list", CmdHF14AList, 0, "[Deprecated] List ISO 14443a history"},
|
||||||
{"reader", CmdHF14AReader, 0, "Act like an ISO14443 Type A reader"},
|
{"reader", CmdHF14AReader, 0, "Act like an ISO14443 Type A reader"},
|
||||||
|
{"info", CmdHF14AInfo, 0, "Reads card and shows information about it"},
|
||||||
{"cuids", CmdHF14ACUIDs, 0, "<n> Collect n>0 ISO14443 Type A UIDs in one go"},
|
{"cuids", CmdHF14ACUIDs, 0, "<n> Collect n>0 ISO14443 Type A UIDs in one go"},
|
||||||
{"sim", CmdHF14ASim, 0, "<UID> -- Simulate ISO 14443a tag"},
|
{"sim", CmdHF14ASim, 0, "<UID> -- Simulate ISO 14443a tag"},
|
||||||
{"snoop", CmdHF14ASnoop, 0, "Eavesdrop ISO 14443 Type A"},
|
{"snoop", CmdHF14ASnoop, 0, "Eavesdrop ISO 14443 Type A"},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue