]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdhf14b.c
CHG: some magic generation1 tags is not following protocol and answers to the "halt...
[proxmark3-svn] / client / cmdhf14b.c
index d1eb99175c69e81ec33b47f5bdd4e768eacb5b04..7b67f8c2646759064e43f173cb34bb73d48a1152 100644 (file)
@@ -11,7 +11,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdbool.h>
-//#include <string.h>
 #include <stdint.h>
 #include "iso14443crc.h"
 #include "proxmark3.h"
@@ -35,7 +34,7 @@ int CmdHF14BList(const char *Cmd)
 
 int CmdHF14BSim(const char *Cmd)
 {
-       UsbCommand c={CMD_SIMULATE_TAG_ISO_14443B};
+       UsbCommand c = {CMD_SIMULATE_TAG_ISO_14443B};
        clearCommandBuffer();
        SendCommand(&c);
        return 0;
@@ -43,7 +42,7 @@ int CmdHF14BSim(const char *Cmd)
 
 int CmdHF14BSnoop(const char *Cmd)
 {
-  UsbCommand c = {CMD_SNOOP_ISO_14443B};
+       UsbCommand c = {CMD_SNOOP_ISO_14443B};
        clearCommandBuffer();
        SendCommand(&c);
        return 0;
@@ -74,10 +73,14 @@ int CmdSrix4kRead(const char *Cmd)
 }
 
 int rawClose(void){
+       UsbCommand resp;
        UsbCommand c = {CMD_ISO_14443B_COMMAND, {0, 0, 0}};
        clearCommandBuffer();
        SendCommand(&c);
+       if (!WaitForResponseTimeout(CMD_ACK,&resp,1000)) {
        return 0;       
+       }
+       return 0;
 }
 
 int HF14BCmdRaw(bool reply, bool *crc, bool power, uint8_t *data, uint8_t *datalen, bool verbose){
@@ -225,7 +228,7 @@ int CmdHF14BCmdRaw (const char *Cmd) {
                // REQB
                if (HF14BCmdRaw(true, &crc2, true, cmd2, &cmdLen, false)==0) return rawClose();
                                                                          
-               PrintAndLog("REQB   : %s", sprint_hex(cmd2, 9));
+               PrintAndLog("REQB   : %s", sprint_hex(cmd2, cmdLen));
                
                if ( SRx && (cmdLen != 3 || !crc2) ) return rawClose();
                else if (cmd2[0] != 0x50 || cmdLen != 14 || !crc2) return rawClose();
@@ -251,7 +254,7 @@ int CmdHF14BCmdRaw (const char *Cmd) {
                
                // attrib
                if (HF14BCmdRaw(true, &crc2, true, cmd2, &cmdLen, false)==0) return rawClose();
-               PrintAndLog("ATTRIB : %s", sprint_hex(cmd2, 3));
+               PrintAndLog("ATTRIB : %s", sprint_hex(cmd2, cmdLen));
                
                if (cmdLen != 3 || !crc2) return rawClose();            
                if (SRx && cmd2[0] != chipID) return rawClose();
Impressum, Datenschutz