]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdhf15.c
BUG: the lf read now uses "getbigbuffer" which the offset from where the data start...
[proxmark3-svn] / client / cmdhf15.c
index ec8987559b94ee3377e4babf8be988ff7f2adfed..bdc08521144bc5d12480790e84b135d6ea726686 100644 (file)
@@ -33,7 +33,7 @@
 #include "ui.h"
 #include "cmdparser.h"
 #include "cmdhf15.h"
 #include "ui.h"
 #include "cmdparser.h"
 #include "cmdhf15.h"
-#include "iso15693tools.h"
+#include "../common/iso15693tools.h"
 #include "cmdmain.h"
 
 #define FrameSOF              Iso15693FrameSOF
 #include "cmdmain.h"
 
 #define FrameSOF              Iso15693FrameSOF
@@ -44,8 +44,7 @@
 #define Crc(data,datalen)     Iso15693Crc(data,datalen)
 #define AddCrc(data,datalen)  Iso15693AddCrc(data,datalen)
 #define sprintUID(target,uid)  Iso15693sprintUID(target,uid)
 #define Crc(data,datalen)     Iso15693Crc(data,datalen)
 #define AddCrc(data,datalen)  Iso15693AddCrc(data,datalen)
 #define sprintUID(target,uid)  Iso15693sprintUID(target,uid)
-
-static int CmdHelp(const char *Cmd);
+#define TRACE_BUFF_SIZE 12000
 
 // structure and database for uid -> tagtype lookups 
 typedef struct { 
 
 // structure and database for uid -> tagtype lookups 
 typedef struct { 
@@ -60,8 +59,10 @@ const productName uidmapping[] = {
        { 0xE001000000000000LL, 16, "Motorola" },
        { 0xE002000000000000LL, 16, "ST Microelectronics" },
        { 0xE003000000000000LL, 16, "Hitachi" },
        { 0xE001000000000000LL, 16, "Motorola" },
        { 0xE002000000000000LL, 16, "ST Microelectronics" },
        { 0xE003000000000000LL, 16, "Hitachi" },
-       { 0xE004000000000000LL, 16, "Philips" },
-       { 0xE004010000000000LL, 24, "Philips; IC SL2 ICS20" },
+       { 0xE004000000000000LL, 16, "NXP(Philips)" },
+       { 0xE004010000000000LL, 24, "NXP(Philips); IC SL2 ICS20/ICS21(SLI) ICS2002/ICS2102(SLIX)" },
+       { 0xE004020000000000LL, 24, "NXP(Philips); IC SL2 ICS53/ICS54(SLI-S) ICS5302/ICS5402(SLIX-S)" },
+       { 0xE004030000000000LL, 24, "NXP(Philips); IC SL2 ICS50/ICS51(SLI-L) ICS5002/ICS5102(SLIX-L)" },
        { 0xE005000000000000LL, 16, "Infineon" },
        { 0xE005400000000000LL, 24, "Infineon; 56x32bit" },
        { 0xE006000000000000LL, 16, "Cylinc" },
        { 0xE005000000000000LL, 16, "Infineon" },
        { 0xE005400000000000LL, 24, "Infineon; 56x32bit" },
        { 0xE006000000000000LL, 16, "Cylinc" },
@@ -254,6 +255,17 @@ int CmdHF15Read(const char *Cmd)
 {
        UsbCommand c = {CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_15693};
        SendCommand(&c);
 {
        UsbCommand c = {CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_15693};
        SendCommand(&c);
+
+       uint8_t data[TRACE_BUFF_SIZE] = {0x00};
+       
+       GetFromBigBuf(data,TRACE_BUFF_SIZE,3560);  //3560 -- should be offset..
+       WaitForResponseTimeout(CMD_ACK,NULL, 1500);
+
+       for (int j = 0; j < TRACE_BUFF_SIZE; j++) {
+               GraphBuffer[j] = ((int)data[j]) ;
+       }
+       GraphTraceLen = TRACE_BUFF_SIZE;
+       RepaintGraphWindow();
        return 0;
 }
 
        return 0;
 }
 
@@ -262,6 +274,17 @@ int CmdHF15Record(const char *Cmd)
 {
        UsbCommand c = {CMD_RECORD_RAW_ADC_SAMPLES_ISO_15693};
        SendCommand(&c);
 {
        UsbCommand c = {CMD_RECORD_RAW_ADC_SAMPLES_ISO_15693};
        SendCommand(&c);
+
+       uint8_t data[TRACE_BUFF_SIZE] = {0x00};
+       
+       GetFromBigBuf(data,TRACE_BUFF_SIZE,3560);  //3560 -- should be offset..
+       WaitForResponseTimeout(CMD_ACK,NULL, 1500);
+
+       for (int j = 0; j < TRACE_BUFF_SIZE; j++) {
+               GraphBuffer[j] = ((int)data[j]) ;
+       }
+       GraphTraceLen = TRACE_BUFF_SIZE;
+       RepaintGraphWindow();
        return 0;
 }
 
        return 0;
 }
 
@@ -326,9 +349,9 @@ int CmdHF15DumpMem(const char*Cmd) {
                                if (!(recv[0] & ISO15_RES_ERROR)) {
                                        retry=0;
                                        *output=0; // reset outputstring
                                if (!(recv[0] & ISO15_RES_ERROR)) {
                                        retry=0;
                                        *output=0; // reset outputstring
-                                       sprintf(output, "Block %2i   ",blocknum);
+                                       sprintf(output, "Block %02x   ",blocknum);
                                        for ( int i=1; i<resp.arg[0]-2; i++) { // data in hex
                                        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
                                        }                                       
                                        strcat(output,"   "); 
                                        for ( int i=1; i<resp.arg[0]-2; i++) { // data in cleaned ascii
@@ -423,8 +446,9 @@ int CmdHF15CmdInquiry(const char *Cmd)
 int CmdHF15CmdDebug( const char *cmd) {
        int debug=atoi(cmd);
        if (strlen(cmd)<1) {
 int CmdHF15CmdDebug( const char *cmd) {
        int debug=atoi(cmd);
        if (strlen(cmd)<1) {
-               PrintAndLog("Usage: hf 15 cmd debug  <0/1>");
-               PrintAndLog("   0..no debugging output  1..turn debugging on"); 
+               PrintAndLog("Usage: hf 15 cmd debug  <0|1>");
+               PrintAndLog("   0 no debugging");
+               PrintAndLog("   1 turn debugging on");  
                return 0;
        }
 
                return 0;
        }
 
@@ -516,7 +540,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
                        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);
                                }
                                PrintAndLog("%s", hexout);
                                free(hexout);
@@ -669,7 +693,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++) {
                        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 = ");
                                }                                       
                                strcat(output,"\n\r");
                                strcat(output,"UID = ");
@@ -679,11 +703,11 @@ int CmdHF15CmdSysinfo(const char *Cmd) {
                                strcat(output,"\n\r");
                                i=10;
                                if (recv[1] & 0x01) 
                                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) 
                                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) {
                                else 
                                        strcat(output,"AFI not supported\n\r");
                                if (recv[1] & 0x04) {
@@ -693,7 +717,7 @@ int CmdHF15CmdSysinfo(const char *Cmd) {
                                        i+=2;
                                } else 
                                        strcat(output,"Tag does not provide information on memory layout\n\r");
                                        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");
 
 
                                        else strcat(output,"IC reference not given\n\r");
 
 
@@ -770,7 +794,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++) {
                        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++) {
                                }                                       
                                strcat(output,"   ");
                                for ( int i=1; i<resp.arg[0]-2; i++) {
@@ -844,7 +868,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++) {
                                *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++) {
                                }                                       
                                strcat(output,"   ");
                                for ( int i=1; i<resp.arg[0]-2; i++) {
Impressum, Datenschutz