]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdhf.c
Merge pull request #49 from marshmellow42/master
[proxmark3-svn] / client / cmdhf.c
index 20ca057b3846629e62d75320b22da4881f040c87..fbc2d7b257a8312ac42412aa6d5265c34c44e982 100644 (file)
@@ -22,6 +22,7 @@
 #include "cmdhflegic.h"
 #include "cmdhficlass.h"
 #include "cmdhfmf.h"
+#include "cmdhfmfu.h"
 
 static int CmdHelp(const char *Cmd);
 
@@ -193,7 +194,7 @@ void annotateIso14443a(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize)
        case ISO14443A_CMD_ANTICOLL_OR_SELECT:{
                // 93 20 = Anticollision (usage: 9320 - answer: 4bytes UID+1byte UID-bytes-xor)
                // 93 70 = Select (usage: 9370+5bytes 9320 answer - answer: 1byte SAK)
-               if(cmd[2] == 0x70)
+               if(cmd[1] == 0x70)
                {
                        snprintf(exp,size,"SELECT_UID"); break;
                }else
@@ -221,8 +222,8 @@ void annotateIso14443a(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize)
        case MIFARE_CMD_DEC:          snprintf(exp,size,"DEC(%d)",cmd[1]); break;
        case MIFARE_CMD_RESTORE:      snprintf(exp,size,"RESTORE(%d)",cmd[1]); break;
        case MIFARE_CMD_TRANSFER:     snprintf(exp,size,"TRANSFER(%d)",cmd[1]); break;
-       case MIFARE_AUTH_KEYA:        snprintf(exp,size,"AUTH-A"); break;
-       case MIFARE_AUTH_KEYB:        snprintf(exp,size,"AUTH-B"); break;
+       case MIFARE_AUTH_KEYA:        snprintf(exp,size,"AUTH-A(%d)",cmd[1]); break;
+       case MIFARE_AUTH_KEYB:        snprintf(exp,size,"AUTH-B(%d)",cmd[1]); break;
        case MIFARE_MAGICMODE:        snprintf(exp,size,"MAGIC"); break;
        default:                      snprintf(exp,size,"?"); break;
        }
@@ -519,9 +520,9 @@ int CmdHFList(const char *Cmd)
        int tlen = param_getstr(Cmd,0,type);
        char param = param_getchar(Cmd, 1);
        bool errors = false;
-       uint8_t protocol = false;
+       uint8_t protocol = 0;
        //Validate params
-       if(tlen == 0 || (strcmp(type, "iclass") != 0 && strcmp(type,"14a") != 0))
+       if(tlen == 0)
        {
                errors = true;
        }
@@ -529,6 +530,25 @@ int CmdHFList(const char *Cmd)
        {
                errors = true;
        }
+       if(!errors)
+       {
+               if(strcmp(type, "iclass") == 0)
+               {
+                       protocol = ICLASS;
+               }else if(strcmp(type, "14a") == 0)
+               {
+                       protocol = ISO_14443A;
+               }
+               else if(strcmp(type, "14b") == 0)
+               {
+                       protocol = ISO_14443B;
+               }else if(strcmp(type,"raw")== 0)
+               {
+                       protocol = -1;//No crc, no annotations
+               }else{
+                       errors = true;
+               }
+       }
 
        if (errors) {
                PrintAndLog("List protocol data in trace buffer.");
@@ -543,20 +563,7 @@ int CmdHFList(const char *Cmd)
                PrintAndLog("example: hf list iclass");
                return 0;
        }
-       if(strcmp(type, "iclass") == 0)
-       {
-               protocol = ICLASS;
-       }else if(strcmp(type, "14a") == 0)
-       {
-               protocol = ISO_14443A;
-       }
-       else if(strcmp(type, "14b") == 0)
-       {
-               protocol = ISO_14443B;
-       }else if(strcmp(type,"raw")== 0)
-       {
-               protocol = -1;//No crc, no annotations
-       }
+
 
        if (param == 'f') {
                showWaitCycles = true;
@@ -595,6 +602,7 @@ static command_t CommandTable[] =
   {"legic",       CmdHFLegic,       0, "{ LEGIC RFIDs... }"},
   {"iclass",      CmdHFiClass,      1, "{ ICLASS RFIDs... }"},
   {"mf",               CmdHFMF,                1, "{ MIFARE RFIDs... }"},
+  {"mfu",                      CmdHFMFUltra,           1, "{ MIFARE Ultralight RFIDs... }"},
   {"tune",        CmdHFTune,        0, "Continuously measure HF antenna tuning"},
   {"list",       CmdHFList,         1, "List protocol data in trace buffer"},
        {NULL, NULL, 0, NULL}
Impressum, Datenschutz