]> cvs.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdhfmfu.c
Merge pull request #322 from Proxmark/iceman1001-patch-2
[proxmark3-svn] / client / cmdhfmfu.c
index 9c5f7a833bd89636ac59e4aaa26e5bb8d64596a3..815022501bc97b227d0b48a32400659dd2cf5e81 100644 (file)
@@ -7,9 +7,16 @@
 //-----------------------------------------------------------------------------
 // High frequency MIFARE ULTRALIGHT (C) commands
 //-----------------------------------------------------------------------------
-#include <ctype.h>
-#include "loclass/des.h"
+
 #include "cmdhfmfu.h"
+
+#include <stdint.h>
+#include <stdio.h>
+#include "proxmark3.h"
+#include "usb_cmd.h"
+#include "cmdmain.h"
+#include "ui.h"
+#include "loclass/des.h"
 #include "cmdhfmf.h"
 #include "cmdhf14a.h"
 #include "mifare.h"
@@ -1231,7 +1238,7 @@ int CmdHF14AMfUDump(const char *Cmd){
        bool manualPages = false;
        uint8_t startPage = 0;
        char tempStr[50];
-       char cleanASCII[4];
+       unsigned char cleanASCII[4];
 
        while(param_getchar(Cmd, cmdp) != 0x00)
        {
@@ -1424,12 +1431,7 @@ int CmdHF14AMfUDump(const char *Cmd){
 
                // convert unprintable characters and line breaks to dots
                memcpy(cleanASCII, data+i*4, 4);
-
-               for (size_t clean_i = 0; clean_i < 4; clean_i++) {
-                       if (!isprint(cleanASCII[clean_i])) {
-                               cleanASCII[clean_i] = '.';
-                       }
-               }
+               clean_ascii(cleanASCII, 4);
 
                PrintAndLog("%3d/0x%02X | %s| %d | %.4s", i+startPage, i+startPage, sprint_hex(data + i * 4, 4), tmplockbit, cleanASCII);
        }
@@ -1472,7 +1474,7 @@ int CmdHF14AMfucAuth(const char *Cmd){
        //Change key to user defined one
        if (cmdp == 'k' || cmdp == 'K'){
                keyNo = param_get8(Cmd, 1);
-               if(keyNo > KEYS_3DES_COUNT) 
+               if(keyNo > KEYS_3DES_COUNT-1
                        errors = true;
        }
 
Impressum, Datenschutz