]> cvs.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdhf.c
Increase threshold to 160, fix for issue 756 (#760)
[proxmark3-svn] / client / cmdhf.c
index 82313ae0cae0da63341566c68055f117426f02c5..744a95d298e6d9c1b8516781e9c6672718a089f3 100644 (file)
@@ -9,18 +9,18 @@
 // High frequency commands
 //-----------------------------------------------------------------------------
 
+#include "cmdhf.h"
+
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include "proxmark3.h"
+#include "comms.h"
 #include "util.h"
-#include "data.h"
 #include "ui.h"
 #include "iso14443crc.h"
 #include "parity.h"
 #include "cmdmain.h"
 #include "cmdparser.h"
-#include "cmdhf.h"
 #include "cmdhf14a.h"
 #include "cmdhf14b.h"
 #include "cmdhf15.h"
 #include "cmdhflegic.h"
 #include "cmdhficlass.h"
 #include "cmdhfmf.h"
+#include "cmdhfmfp.h"
 #include "cmdhfmfu.h"
 #include "cmdhftopaz.h"
 #include "protocols.h"
 #include "emv/cmdemv.h"
 #include "cmdhflist.h"
+#include "cmdhffido.h"
 
 static int CmdHelp(const char *Cmd);
 
@@ -262,7 +264,7 @@ uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *trace, ui
 
                uint8_t parityBits = parityBytes[j>>3];
                if (protocol != ISO_14443B && (isResponse || protocol == ISO_14443A) && (oddparity8(frame[j]) != ((parityBits >> (7-(j&0x0007))) & 0x01))) {
-                       snprintf(line[j/16]+(( j % 16) * 4),110, "%02x! ", frame[j]);
+                       snprintf(line[j/16]+(( j % 16) * 4), 110, " %02x!", frame[j]);
                } else {
                        snprintf(line[j/16]+(( j % 16) * 4), 110, " %02x ", frame[j]);
                }
@@ -279,14 +281,11 @@ uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *trace, ui
                }
        }
 
-       if(data_len == 0)
-       {
-               if(data_len == 0){
-                       sprintf(line[0],"<empty trace - possible error>");
-               }
+       if (data_len == 0) {
+               sprintf(line[0]," <empty trace - possible error>");
        }
-       //--- Draw the CRC column
 
+       //--- Draw the CRC column
        char *crc = (crcStatus == 0 ? "!crc" : (crcStatus == 1 ? " ok " : "    "));
 
        EndOfTransmissionTimestamp = timestamp + duration;
@@ -353,6 +352,12 @@ uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *trace, ui
 
 int CmdHFList(const char *Cmd)
 {
+       #ifdef WITH_SMARTCARD
+               PrintAndLog("TEST_WITH_SMARTCARD");
+       #endif
+       #ifdef WITH_TEST
+               PrintAndLog("TEST_WITH_TEST");
+       #endif
        bool showWaitCycles = false;
        bool markCRCBytes = false;
        bool loadFromFile = false;
@@ -361,7 +366,7 @@ int CmdHFList(const char *Cmd)
        char param2 = '\0';
        char param3 = '\0';
        char type[40] = {0};
-       char filename[FILE_PATH_SIZE];
+       char filename[FILE_PATH_SIZE] = {0};
        uint8_t protocol = 0;
        
        // parse command line
@@ -407,6 +412,8 @@ int CmdHFList(const char *Cmd)
                        protocol = ISO_14443B;
                } else if(strcmp(type,"topaz") == 0) {
                        protocol = TOPAZ;
+               } else if(strcmp(type, "7816") == 0) {
+                       protocol = ISO_7816_4;  
                } else if(strcmp(type,"raw") == 0) {
                        protocol = -1; //No crc, no annotations
                } else if (strcmp(type, "save") == 0) {
@@ -497,8 +504,7 @@ int CmdHFList(const char *Cmd)
                trace = malloc(USB_CMD_DATA_SIZE);
                // Query for the size of the trace
                UsbCommand response;
-               GetFromBigBuf(trace, USB_CMD_DATA_SIZE, 0);
-               WaitForResponse(CMD_ACK, &response);
+               GetFromBigBuf(trace, USB_CMD_DATA_SIZE, 0, &response, -1, false);
                traceLen = response.arg[2];
                if (traceLen > USB_CMD_DATA_SIZE) {
                        uint8_t *p = realloc(trace, traceLen);
@@ -508,8 +514,7 @@ int CmdHFList(const char *Cmd)
                                return 2;
                        }
                        trace = p;
-                       GetFromBigBuf(trace, traceLen, 0);
-                       WaitForResponse(CMD_ACK, NULL);
+                       GetFromBigBuf(trace, traceLen, 0, NULL, -1, false);
                }
        }
 
@@ -586,12 +591,13 @@ static command_t CommandTable[] =
        {"14b",         CmdHF14B,               1, "{ ISO14443B RFIDs... }"},
        {"15",          CmdHF15,                1, "{ ISO15693 RFIDs... }"},
        {"epa",         CmdHFEPA,               1, "{ German Identification Card... }"},
-       {"emv",         CmdHFEMV,               1, "{ EMV cards... }"},
        {"legic",       CmdHFLegic,             0, "{ LEGIC RFIDs... }"},
        {"iclass",      CmdHFiClass,    1, "{ ICLASS RFIDs... }"},
        {"mf",          CmdHFMF,                1, "{ MIFARE RFIDs... }"},
        {"mfu",         CmdHFMFUltra,   1, "{ MIFARE Ultralight RFIDs... }"},
+       {"mfp",         CmdHFMFP,               1, "{ MIFARE Plus RFIDs... }"},
        {"topaz",       CmdHFTopaz,             1, "{ TOPAZ (NFC Type 1) RFIDs... }"},
+       {"fido",        CmdHFFido,              1, "{ FIDO and FIDO2 authenticators... }"},
        {"tune",        CmdHFTune,              0, "Continuously measure HF antenna tuning"},
        {"list",        CmdHFList,              1, "List protocol data in trace buffer"},
        {"search",      CmdHFSearch,    1, "Search for known HF tags [preliminary]"},
Impressum, Datenschutz