]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdhftopaz.c
chg: the windows exe annoys the linux compiler
[proxmark3-svn] / client / cmdhftopaz.c
index 4296cc94d8c5de99bc0b2ee64118efcbf1472040..271f41b0604c32c4a74ebe6dd53450d5da5654f5 100644 (file)
@@ -21,6 +21,7 @@
 #include "proxmark3.h"
 #include "iso14443crc.h"
 #include "protocols.h"
+#include "cmdhf.h"
 
 #define TOPAZ_MAX_MEMORY       2048
 
@@ -33,7 +34,6 @@ static struct {
        uint8_t *dynamic_reserved_areas;
 } topaz_tag;
 
-
 static void topaz_switch_on_field(void)
 {
        UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_CONNECT | ISO14A_NO_SELECT | ISO14A_NO_DISCONNECT | ISO14A_TOPAZMODE, 0, 0}};
@@ -252,13 +252,12 @@ static void topaz_print_NDEF(uint8_t *data)
 }
 
        
-int CmdHFTopazReader(const char *Cmd)
-{
+int CmdHFTopazReader(const char *Cmd) {
        int status;
        uint8_t atqa[2];
        uint8_t rid_response[8];
        uint8_t *uid_echo = &rid_response[2];
-       uint8_t rall_response[124];
+       uint8_t rall_response[130];
        
        status = topaz_select(atqa, rid_response);
        
@@ -287,7 +286,7 @@ int CmdHFTopazReader(const char *Cmd)
        PrintAndLog("HR0  : %02x (%sa Topaz tag (%scapable of carrying a NDEF message), %s memory map)", rid_response[0], 
                                                (rid_response[0] & 0xF0) == 0x10 ? "" : "not ",
                                                (rid_response[0] & 0xF0) == 0x10 ? "" : "not ",
-                                               (rid_response[0] & 0x0F) == 0x10 ? "static" : "dynamic");
+                                               (rid_response[0] & 0x0F) == 0x01 ? "static" : "dynamic");
        PrintAndLog("HR1  : %02x", rid_response[1]);
        
        status = topaz_rall(uid_echo, rall_response);
@@ -349,10 +348,16 @@ int CmdHFTopazReader(const char *Cmd)
 
        PrintAndLog("");
        bool lock_TLV_present = topaz_print_lock_control_TLVs(&topaz_tag.data_blocks[1][4]);
-
+       if ( lock_TLV_present ) {
+               PrintAndLog("");        
+       }
+       
        PrintAndLog("");
        bool reserved_mem_present = topaz_print_reserved_memory_control_TLVs(&topaz_tag.data_blocks[1][4]);
-
+       if (reserved_mem_present) {
+               PrintAndLog("");        
+       }
+       
        topaz_print_lifecycle_state(&topaz_tag.data_blocks[1][0]);
 
        topaz_print_NDEF(&topaz_tag.data_blocks[1][0]);
@@ -361,39 +366,39 @@ int CmdHFTopazReader(const char *Cmd)
        return 0;
 }
 
-
-int CmdHFTopazSim(const char *Cmd)
-{
+int CmdHFTopazSim(const char *Cmd) {
        PrintAndLog("not yet implemented");
        return 0;
 }
 
-
-int CmdHFTopazCmdRaw(const char *Cmd)
-{
+int CmdHFTopazCmdRaw(const char *Cmd) {
        PrintAndLog("not yet implemented");
        return 0;
 }
 
+int CmdHFTopazList(const char *Cmd) {
+       CmdHFList("topaz");
+       return 0;
+}
 
 static int CmdHelp(const char *Cmd);
 
-
 static command_t CommandTable[] = 
 {
        {"help",        CmdHelp,                        1, "This help"},
        {"reader",      CmdHFTopazReader,       0, "Act like a Topaz reader"},
        {"sim",         CmdHFTopazSim,          0, "<UID> -- Simulate Topaz tag"},
-       {"snoop",       CmdHF14ASnoop,          0, "Eavesdrop a Topaz reader-tag communication"},
+       {"sniff",       CmdHF14ASniff,          0, "Sniff Topaz reader-tag communication"},
        {"raw",         CmdHFTopazCmdRaw,       0, "Send raw hex data to tag"},
+       {"list",        CmdHFTopazList,         0, "[Deprecated] List Topaz history"},
        {NULL,          NULL,                           0, NULL}
 };
 
-
 int CmdHFTopaz(const char *Cmd) {
        // flush
-       WaitForResponseTimeout(CMD_ACK,NULL,100);
-
+       //WaitForResponseTimeout(CMD_ACK,NULL,100);
+       clearCommandBuffer();
+       
        // parse
        CmdsParse(CommandTable, Cmd);
        return 0;
Impressum, Datenschutz