X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/7fe9b0b742d7dae9c5af1d292d11840b5c3cbfae..cee5a30d53c7aff4c4830eae53eaf58414ecf806:/client/cmdhf14a.c diff --git a/client/cmdhf14a.c b/client/cmdhf14a.c index ebf0ea4a..145f6a67 100644 --- a/client/cmdhf14a.c +++ b/client/cmdhf14a.c @@ -1,4 +1,15 @@ +//----------------------------------------------------------------------------- +// Copyright (C) 2010 iZsh , Hagen Fritsch +// +// This code is licensed to you under the terms of the GNU GPL, version 2 or, +// at your option, any later version. See the LICENSE.txt file for the text of +// the license. +//----------------------------------------------------------------------------- +// High frequency ISO14443A commands +//----------------------------------------------------------------------------- + #include +#include #include #include "iso14443crc.h" #include "data.h" @@ -6,6 +17,7 @@ #include "ui.h" #include "cmdparser.h" #include "cmdhf14a.h" +#include "common.h" static int CmdHelp(const char *Cmd); @@ -136,6 +148,11 @@ int CmdHF14AList(const char *Cmd) return 0; } +void iso14a_set_timeout(uint32_t timeout) { + UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_SET_TIMEOUT, 0, timeout}}; + SendCommand(&c); +} + int CmdHF14AMifare(const char *Cmd) { UsbCommand c = {CMD_READER_MIFARE, {strtol(Cmd, NULL, 0), 0, 0}}; @@ -145,9 +162,26 @@ int CmdHF14AMifare(const char *Cmd) int CmdHF14AReader(const char *Cmd) { - UsbCommand c = {CMD_READER_ISO_14443a, {strtol(Cmd, NULL, 0), 0, 0}}; - SendCommand(&c); - return 0; + UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_CONNECT, 0, 0}}; + SendCommand(&c); + UsbCommand * resp = WaitForResponse(CMD_ACK); + uint8_t * uid = resp->d.asBytes; + iso14a_card_select_t * card = uid + 12; + + if(resp->arg[0] == 0) { + PrintAndLog("iso14443a card select failed"); + return 0; + } + + PrintAndLog("ATQA : %02x %02x", card->atqa[0], card->atqa[1]); + PrintAndLog(" UID : %s", sprint_hex(uid, 12)); + PrintAndLog(" SAK : %02x [%d]", card->sak, resp->arg[0]); + if(resp->arg[0] == 1) + PrintAndLog(" ATS : %s", sprint_hex(card->ats, card->ats_len)); + else + PrintAndLog("proprietary non-iso14443a card found, RATS not supported"); + + return resp->arg[0]; } // ## simulate iso14443a tag