X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/6b6aafabcfc96bbf3af083efa659553b5d4a6a45..9764d3ea0ec65f520efd4528301da00eedbfbad4:/client/cmdhf14a.c diff --git a/client/cmdhf14a.c b/client/cmdhf14a.c index 58d1e8b2..db9ce46e 100644 --- a/client/cmdhf14a.c +++ b/client/cmdhf14a.c @@ -15,6 +15,7 @@ #include #include #include "util.h" +#include "util_posix.h" #include "iso14443crc.h" #include "data.h" #include "proxmark3.h" @@ -25,6 +26,7 @@ #include "cmdmain.h" #include "mifare.h" #include "cmdhfmfu.h" +#include "mifarehost.h" static int CmdHelp(const char *Cmd); static void waitCmd(uint8_t iLen); @@ -409,8 +411,13 @@ int CmdHF14AReader(const char *Cmd) c.arg[2] = 0; SendCommand(&c); WaitForResponse(CMD_ACK,&resp); - uint8_t isOK = resp.arg[0] & 0xff; - PrintAndLog("Answers to chinese magic backdoor commands: %s", (isOK ? "YES" : "NO") ); + + 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; @@ -435,7 +442,7 @@ int CmdHF14ACUIDs(const char *Cmd) // 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; @@ -574,6 +581,7 @@ int CmdHF14ACmdRaw(const char *cmd) { 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; @@ -594,6 +602,7 @@ int CmdHF14ACmdRaw(const char *cmd) { 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; } @@ -638,6 +647,9 @@ int CmdHF14ACmdRaw(const char *cmd) { case 'T': topazmode = true; break; + case '3': + no_rats = true; + break; default: PrintAndLog("Invalid option"); return 0; @@ -711,6 +723,10 @@ int CmdHF14ACmdRaw(const char *cmd) { 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);