]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdhf15.c
bugfixes in iso14443a.c and hf 14a reader
[proxmark3-svn] / client / cmdhf15.c
index e1e5e02a79e988ea397ffe3f10ba735e0360879a..2239e9e4634ff151e5181050800af12e294d574a 100644 (file)
@@ -26,7 +26,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <stdint.h>
-#include "proxusb.h"
+//#include "proxusb.h"
 #include "proxmark3.h"
 #include "data.h"
 #include "graph.h"
@@ -45,8 +45,6 @@
 #define AddCrc(data,datalen)  Iso15693AddCrc(data,datalen)
 #define sprintUID(target,uid)  Iso15693sprintUID(target,uid)
 
-static int CmdHelp(const char *Cmd);
-
 // structure and database for uid -> tagtype lookups 
 typedef struct { 
        uint64_t uid;
@@ -328,7 +326,7 @@ int CmdHF15DumpMem(const char*Cmd) {
                                        *output=0; // reset outputstring
                                        sprintf(output, "Block %2i   ",blocknum);
                                        for ( int i=1; i<resp.arg[0]-2; i++) { // data in hex
-                                               sprintf(output+strlen(output),"%02hX ",recv[i]);                                        
+                                               sprintf(output+strlen(output),"%02X ",recv[i]);
                                        }                                       
                                        strcat(output,"   "); 
                                        for ( int i=1; i<resp.arg[0]-2; i++) { // data in cleaned ascii
@@ -516,7 +514,7 @@ int CmdHF15CmdRaw (const char *cmd) {
                        hexout = (char *)malloc(resp.arg[0] * 3 + 1);
                        if (hexout != NULL) {
                                for (int i = 0; i < resp.arg[0]; i++) { // data in hex
-                                       sprintf(&hexout[i * 3], "%02hX ", recv[i]);
+                                       sprintf(&hexout[i * 3], "%02X ", recv[i]);
                                }
                                PrintAndLog("%s", hexout);
                                free(hexout);
@@ -537,7 +535,8 @@ int CmdHF15CmdRaw (const char *cmd) {
  */
 int prepareHF15Cmd(char **cmd, UsbCommand *c, uint8_t iso15cmd[], int iso15cmdlen) {
        int temp;
-       uint8_t *req=c->d.asBytes, uid[8];
+       uint8_t *req=c->d.asBytes;
+       uint8_t uid[8] = {0};
        uint32_t reqlen=0;
 
        // strip
@@ -669,7 +668,7 @@ int CmdHF15CmdSysinfo(const char *Cmd) {
                        if (!(recv[0] & ISO15_RES_ERROR)) {
                                *output=0; // reset outputstring
                                for ( i=1; i<resp.arg[0]-2; i++) {
-                                       sprintf(output+strlen(output),"%02hX ",recv[i]);                                        
+                                       sprintf(output+strlen(output),"%02X ",recv[i]);
                                }                                       
                                strcat(output,"\n\r");
                                strcat(output,"UID = ");
@@ -679,11 +678,11 @@ int CmdHF15CmdSysinfo(const char *Cmd) {
                                strcat(output,"\n\r");
                                i=10;
                                if (recv[1] & 0x01) 
-                                       sprintf(output+strlen(output),"DSFID supported, set to %02hX\n\r",recv[i++]);
+                                       sprintf(output+strlen(output),"DSFID supported, set to %02X\n\r",recv[i++]);
                                else 
                                        strcat(output,"DSFID not supported\n\r");
                                if (recv[1] & 0x02) 
-                                       sprintf(output+strlen(output),"AFI supported, set to %03hX\n\r",recv[i++]);
+                                       sprintf(output+strlen(output),"AFI supported, set to %03X\n\r",recv[i++]);
                                else 
                                        strcat(output,"AFI not supported\n\r");
                                if (recv[1] & 0x04) {
@@ -693,7 +692,7 @@ int CmdHF15CmdSysinfo(const char *Cmd) {
                                        i+=2;
                                } else 
                                        strcat(output,"Tag does not provide information on memory layout\n\r");
-                               if (recv[1] & 0x08) sprintf(output+strlen(output),"IC reference given: %02hX\n\r",recv[i++]);
+                               if (recv[1] & 0x08) sprintf(output+strlen(output),"IC reference given: %02X\n\r",recv[i++]);
                                        else strcat(output,"IC reference not given\n\r");
 
 
@@ -770,7 +769,7 @@ int CmdHF15CmdReadmulti(const char *Cmd) {
                        if (!(recv[0] & ISO15_RES_ERROR)) {
                                *output=0; // reset outputstring
                                for ( int i=1; i<resp.arg[0]-2; i++) {
-                                       sprintf(output+strlen(output),"%02hX ",recv[i]);                                        
+                                       sprintf(output+strlen(output),"%02X ",recv[i]);
                                }                                       
                                strcat(output,"   ");
                                for ( int i=1; i<resp.arg[0]-2; i++) {
@@ -844,7 +843,7 @@ int CmdHF15CmdRead(const char *Cmd) {
                                *output=0; // reset outputstring
                                //sprintf(output, "Block %2i   ",blocknum);
                                for ( int i=1; i<resp.arg[0]-2; i++) {
-                                       sprintf(output+strlen(output),"%02hX ",recv[i]);                                        
+                                       sprintf(output+strlen(output),"%02X ",recv[i]);
                                }                                       
                                strcat(output,"   ");
                                for ( int i=1; i<resp.arg[0]-2; i++) {
Impressum, Datenschutz