]> git.zerfleddert.de Git - proxmark3-svn/commitdiff
Removed dupicate symbols
authormidnitesnake <midnitesnake@gmail.com>
Sun, 9 Nov 2014 11:40:22 +0000 (11:40 +0000)
committermidnitesnake <midnitesnake@gmail.com>
Sun, 9 Nov 2014 11:40:22 +0000 (11:40 +0000)
client/cmdhfmf.c

index a26652566e812d353a6a1f739ed4a296902561f6..329cc1520aaecc944c1708aaa43124c21957d68a 100644 (file)
@@ -140,116 +140,6 @@ int CmdHF14AMfWrBl(const char *Cmd)
        return 0;\r
 }\r
 \r
-int CmdHF14AMfUWrBl(const char *Cmd)\r
-{\r
-       uint8_t blockNo = 0;\r
-       bool chinese_card=0;\r
-       uint8_t bldata[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};\r
-       UsbCommand resp;\r
-       \r
-       if (strlen(Cmd)<3) {\r
-               PrintAndLog("Usage:  hf mf uwrbl    <block number> <block data (8 hex symbols)> <w>");\r
-               PrintAndLog("        sample: hf mf uwrbl 0 01020304");\r
-               return 0;\r
-       }      \r
-\r
-       blockNo = param_get8(Cmd, 0);\r
-       if (param_gethex(Cmd, 1, bldata, 8)) {\r
-               PrintAndLog("Block data must include 8 HEX symbols");\r
-               return 1;\r
-       }\r
-       \r
-       if (strchr(Cmd,'w') != 0) {\r
-         chinese_card=1;\r
-       }\r
-       \r
-       switch(blockNo){\r
-               case 0:\r
-                       if (!chinese_card){\r
-                               PrintAndLog("Access Denied");\r
-                       }else{\r
-                               PrintAndLog("--specialblock no:%02x", blockNo);\r
-                               PrintAndLog("--data: %s", sprint_hex(bldata, 4));\r
-                               UsbCommand d = {CMD_MIFAREU_WRITEBL, {blockNo}};\r
-                               memcpy(d.d.asBytes,bldata, 4);\r
-                               SendCommand(&d);\r
-\r
-                               if (WaitForResponseTimeout(CMD_ACK,&resp,1500)) {\r
-                                       uint8_t isOK  = resp.arg[0] & 0xff;\r
-                                       PrintAndLog("isOk:%02x", isOK);\r
-                               } else {\r
-                                       PrintAndLog("Command execute timeout");\r
-                             }\r
-                       }\r
-                       break;\r
-               case 1:\r
-                         if (!chinese_card){\r
-                               PrintAndLog("Access Denied");\r
-                         }else{\r
-                               PrintAndLog("--specialblock no:%02x", blockNo);\r
-                               PrintAndLog("--data: %s", sprint_hex(bldata, 4));\r
-                               UsbCommand d = {CMD_MIFAREU_WRITEBL, {blockNo}};\r
-                               memcpy(d.d.asBytes,bldata, 4);\r
-                               SendCommand(&d);\r
-\r
-                               if (WaitForResponseTimeout(CMD_ACK,&resp,1500)) {\r
-                               uint8_t isOK  = resp.arg[0] & 0xff;\r
-                               PrintAndLog("isOk:%02x", isOK);\r
-                               } else {\r
-                                       PrintAndLog("Command execute timeout");\r
-                               }\r
-                       }\r
-                       break;\r
-               case 2:\r
-                       if (!chinese_card){\r
-                               PrintAndLog("Access Denied");\r
-                       }else{\r
-                               PrintAndLog("--specialblock no:%02x", blockNo);\r
-                               PrintAndLog("--data: %s", sprint_hex(bldata, 4));\r
-                               UsbCommand c = {CMD_MIFAREU_WRITEBL, {blockNo}};\r
-                               memcpy(c.d.asBytes, bldata, 4);\r
-                               SendCommand(&c);\r
-\r
-                               if (WaitForResponseTimeout(CMD_ACK,&resp,1500)) {\r
-                                       uint8_t isOK  = resp.arg[0] & 0xff;\r
-                                       PrintAndLog("isOk:%02x", isOK);\r
-                               } else {\r
-                                       PrintAndLog("Command execute timeout");\r
-                               }\r
-                       }\r
-                       break;\r
-               case 3:\r
-                       PrintAndLog("--specialblock no:%02x", blockNo);\r
-                       PrintAndLog("--data: %s", sprint_hex(bldata, 4));\r
-                       UsbCommand d = {CMD_MIFAREU_WRITEBL, {blockNo}};\r
-                       memcpy(d.d.asBytes,bldata, 4);\r
-                       SendCommand(&d);\r
-\r
-                       if (WaitForResponseTimeout(CMD_ACK,&resp,1500)) {\r
-                               uint8_t isOK  = resp.arg[0] & 0xff;\r
-                               PrintAndLog("isOk:%02x", isOK);\r
-                       } else {\r
-                               PrintAndLog("Command execute timeout");\r
-                       }\r
-                       break;\r
-               default: \r
-                       PrintAndLog("--block no:%02x", blockNo);\r
-                       PrintAndLog("--data: %s", sprint_hex(bldata, 4));               \r
-                       UsbCommand e = {CMD_MIFAREU_WRITEBL, {blockNo}};\r
-                       memcpy(e.d.asBytes,bldata, 4);\r
-                       SendCommand(&e);\r
-\r
-                       if (WaitForResponseTimeout(CMD_ACK,&resp,1500)) {\r
-                               uint8_t isOK  = resp.arg[0] & 0xff;\r
-                               PrintAndLog("isOk:%02x", isOK);\r
-                       } else {\r
-                               PrintAndLog("Command execute timeout");\r
-                     }\r
-                     break;\r
-       }\r
-       return 0;\r
-}\r
-\r
 int CmdHF14AMfRdBl(const char *Cmd)\r
 {\r
        uint8_t blockNo = 0;\r
@@ -298,129 +188,6 @@ int CmdHF14AMfRdBl(const char *Cmd)
   return 0;\r
 }\r
 \r
-int CmdHF14AMfURdBl(const char *Cmd)\r
-{\r
-        uint8_t blockNo = 0;\r
-\r
-        if (strlen(Cmd)<1) {\r
-                PrintAndLog("Usage:  hf mf urdbl    <block number>");\r
-                PrintAndLog("        sample: hf mf urdbl 0");\r
-                return 0;\r
-        }       \r
-        \r
-        blockNo = param_get8(Cmd, 0);\r
-        PrintAndLog("--block no:%02x", blockNo);\r
-        \r
-  UsbCommand c = {CMD_MIFAREU_READBL, {blockNo}};\r
-  SendCommand(&c);\r
-\r
-        UsbCommand resp;\r
-        if (WaitForResponseTimeout(CMD_ACK,&resp,1500)) {\r
-                uint8_t                isOK  = resp.arg[0] & 0xff;\r
-                uint8_t              * data  = resp.d.asBytes;\r
-\r
-                if (isOK)\r
-                        PrintAndLog("isOk:%02x data:%s", isOK, sprint_hex(data, 4));\r
-                else\r
-                        PrintAndLog("isOk:%02x", isOK);\r
-        } else {\r
-                PrintAndLog("Command execute timeout");\r
-        }\r
-\r
-  return 0;\r
-}\r
-\r
-int CmdHF14AMfURdCard(const char *Cmd)\r
-{\r
-        int i;\r
-        uint8_t sectorNo = 0;\r
-       uint8_t *lockbytes_t=NULL;\r
-       uint8_t lockbytes[2]={0,0};\r
-       bool bit[16]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};\r
-        \r
-        uint8_t isOK  = 0;\r
-        uint8_t * data  = NULL;\r
-\r
-        if (sectorNo > 15) {\r
-                PrintAndLog("Sector number must be less than 16");\r
-                return 1;\r
-        }\r
-        PrintAndLog("Attempting to Read Ultralight... ");\r
-        \r
-       UsbCommand c = {CMD_MIFAREU_READCARD, {sectorNo}};\r
-       SendCommand(&c);\r
-\r
-        UsbCommand resp;\r
-        if (WaitForResponseTimeout(CMD_ACK,&resp,1500)) {\r
-                isOK  = resp.arg[0] & 0xff;\r
-                data  = resp.d.asBytes;\r
-\r
-                PrintAndLog("isOk:%02x", isOK);\r
-                if (isOK) \r
-                        for (i = 0; i < 16; i++) {\r
-                               switch(i){\r
-                                 case 2:\r
-                                       //process lock bytes\r
-                                       lockbytes_t=data+(i*4);\r
-                                       lockbytes[0]=lockbytes_t[2];\r
-                                       lockbytes[1]=lockbytes_t[3];\r
-                                       for(int j=0; j<16; j++){\r
-                                               bit[j]=lockbytes[j/8] & ( 1 <<(7-j%8));\r
-                                       }\r
-                                       //PrintAndLog("LB %02x %02x", lockbytes[0],lockbytes[1]);\r
-                                       //PrintAndLog("LB2b %02x %02x %02x %02x %02x %02x %02x %02x",bit[8],bit[9],bit[10],bit[11],bit[12],bit[13],bit[14],bit[15]);            \r
-                                       PrintAndLog("Block %02x:%s ", i,sprint_hex(data + i * 4, 4));\r
-                                       break;\r
-                                 case 3: \r
-                                       PrintAndLog("Block %02x:%s [%d]", i,sprint_hex(data + i * 4, 4),bit[4]);\r
-                                       break;\r
-                                 case 4:\r
-                                        PrintAndLog("Block %02x:%s [%d]", i,sprint_hex(data + i * 4, 4),bit[3]);\r
-                                       break;\r
-                                 case 5:\r
-                                        PrintAndLog("Block %02x:%s [%d]", i,sprint_hex(data + i * 4, 4),bit[2]);\r
-                                       break;\r
-                                 case 6:\r
-                                        PrintAndLog("Block %02x:%s [%d]", i,sprint_hex(data + i * 4, 4),bit[1]);\r
-                                       break;\r
-                                 case 7:\r
-                                        PrintAndLog("Block %02x:%s [%d]", i,sprint_hex(data + i * 4, 4),bit[0]);\r
-                                       break;\r
-                                 case 8:\r
-                                        PrintAndLog("Block %02x:%s [%d]", i,sprint_hex(data + i * 4, 4),bit[15]);\r
-                                       break;\r
-                                 case 9:\r
-                                        PrintAndLog("Block %02x:%s [%d]", i,sprint_hex(data + i * 4, 4),bit[14]);\r
-                                       break;\r
-                                 case 10:\r
-                                        PrintAndLog("Block %02x:%s [%d]", i,sprint_hex(data + i * 4, 4),bit[13]);\r
-                                       break;\r
-                                 case 11:\r
-                                        PrintAndLog("Block %02x:%s [%d]", i,sprint_hex(data + i * 4, 4),bit[12]);\r
-                                       break;\r
-                                 case 12:\r
-                                        PrintAndLog("Block %02x:%s [%d]", i,sprint_hex(data + i * 4, 4),bit[11]);\r
-                                       break;\r
-                                 case 13:\r
-                                        PrintAndLog("Block %02x:%s [%d]", i,sprint_hex(data + i * 4, 4),bit[10]);\r
-                                       break;\r
-                                 case 14:\r
-                                        PrintAndLog("Block %02x:%s [%d]", i,sprint_hex(data + i * 4, 4),bit[9]);\r
-                                       break;\r
-                                 case 15:\r
-                                        PrintAndLog("Block %02x:%s [%d]", i,sprint_hex(data + i * 4, 4),bit[8]);\r
-                                       break;\r
-                                 default:\r
-                                       PrintAndLog("Block %02x:%s ", i,sprint_hex(data + i * 4, 4));\r
-                                       break;\r
-                               }\r
-                        }\r
-        } else {\r
-                PrintAndLog("Command1 execute timeout");\r
-        }\r
-  return 0;\r
-}\r
-\r
 int CmdHF14AMfRdSc(const char *Cmd)\r
 {\r
        int i;\r
@@ -1883,9 +1650,8 @@ int CmdHF14AMfSniff(const char *Cmd){
        printf("Press the key on pc keyboard to abort the client.\n");\r
        printf("-------------------------------------------------------------------------\n");\r
 \r
-       UsbCommand c = {CMD_MIFARE_SNIFFER, {0, 0, 0}};\r
-       clearCommandBuffer();\r
-       SendCommand(&c);\r
+  UsbCommand c = {CMD_MIFARE_SNIFFER, {0, 0, 0}};\r
+  SendCommand(&c);\r
 \r
        // wait cycle\r
        while (true) {\r
@@ -1932,7 +1698,7 @@ int CmdHF14AMfSniff(const char *Cmd){
                                                sak = bufPtr[11];\r
                                                \r
                                                PrintAndLog("tag select uid:%s atqa:%02x %02x sak:0x%02x", sprint_hex(uid, 7), atqa[0], atqa[1], sak);\r
-                                               if (wantLogToFile || wantDecrypt) {\r
+                                               if (wantLogToFile) {\r
                                                        FillFileNameByUID(logHexFileName, uid, ".log", 7);\r
                                                        AddLogCurrentDT(logHexFileName);\r
                                                }                                               \r
@@ -1948,8 +1714,7 @@ int CmdHF14AMfSniff(const char *Cmd){
                        }\r
                } // resp not NILL\r
        } // while (true)\r
-       \r
-       return 0;\r
+  return 0;\r
 }\r
 \r
 static command_t CommandTable[] =\r
@@ -1957,9 +1722,6 @@ static command_t CommandTable[] =
   {"help",             CmdHelp,                                                1, "This help"},\r
   {"dbg",                      CmdHF14AMfDbg,                  0, "Set default debug mode"},\r
   {"rdbl",             CmdHF14AMfRdBl,                 0, "Read MIFARE classic block"},\r
-  {"urdbl",              CmdHF14AMfURdBl,                 0, "Read MIFARE Ultralight block"},\r
-  {"urdcard",           CmdHF14AMfURdCard,               0,"Read MIFARE Ultralight Card"},\r
-  {"uwrbl",            CmdHF14AMfUWrBl,                0,"Write MIFARE Ultralight block"},\r
   {"rdsc",             CmdHF14AMfRdSc,                 0, "Read MIFARE classic sector"},\r
   {"dump",             CmdHF14AMfDump,                 0, "Dump MIFARE classic tag to binary file"},\r
   {"restore",  CmdHF14AMfRestore,      0, "Restore MIFARE classic binary file to BLANK tag"},\r
Impressum, Datenschutz