]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdlft55xx.c
ADD: lf indalademod output, The binary string is now printed with linebreaks every...
[proxmark3-svn] / client / cmdlft55xx.c
index 31958eea12df0090e2617f2bc9edc65917cb25e6..21406fc8831ad369994fc6f19dfd126f617bd561 100644 (file)
@@ -461,14 +461,14 @@ bool tryDetectModulation(){
        } else {\r
                clk = GetAskClock("", FALSE, FALSE);\r
                if (clk>0) {\r
-                       if ( ASKDemod("0 0 1", TRUE, FALSE, 1) && test(DEMOD_ASK, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {\r
+                       if ( ASKDemod("0 0 1", FALSE, FALSE, 1) && test(DEMOD_ASK, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {\r
                                tests[hits].modulation = DEMOD_ASK;\r
                                tests[hits].bitrate = bitRate;\r
                                tests[hits].inverted = FALSE;\r
                                tests[hits].block0 = PackBits(tests[hits].offset, 32, DemodBuffer);\r
                                ++hits;\r
                        }\r
-                       if ( ASKDemod("0 1 1", TRUE, FALSE, 1)  && test(DEMOD_ASK, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {\r
+                       if ( ASKDemod("0 1 1", FALSE, FALSE, 1)  && test(DEMOD_ASK, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {\r
                                tests[hits].modulation = DEMOD_ASK;\r
                                tests[hits].bitrate = bitRate;\r
                                tests[hits].inverted = TRUE;\r
@@ -862,19 +862,21 @@ int CmdT55xxWriteBlock(const char *Cmd) {
        UsbCommand resp;\r
        c.d.asBytes[0] = (page1) ? 0x2 : 0; \r
 \r
-       PrintAndLog("Writing to page: %d  block: %d  data : 0x%08X", page1, block, data);\r
+       char pwdStr[16] = {0};\r
+       snprintf(pwdStr, sizeof(pwdStr), "pwd: 0x%08X", password);\r
+       \r
+       PrintAndLog("Writing page %d  block: %02d  data: 0x%08X %s", page1, block, data,  (usepwd) ? pwdStr : "" );\r
 \r
        //Password mode\r
        if (usepwd) {\r
                c.arg[2] = password;\r
                c.d.asBytes[0] |= 0x1; \r
-               PrintAndLog("pwd   : 0x%08X", password);\r
        }\r
        clearCommandBuffer();\r
        SendCommand(&c);\r
        if (!WaitForResponseTimeout(CMD_ACK, &resp, 1000)){\r
                PrintAndLog("Error occurred, device did not ACK write operation. (May be due to old firmware)");\r
-       return 0;\r
+               return 0;\r
        }\r
        return 1;\r
 }\r
@@ -1230,26 +1232,24 @@ char * GetSelectedModulationStr( uint8_t id){
 }\r
 \r
 void t55x7_create_config_block( int tagtype ){\r
-       //switch?\r
-       \r
-       \r
-}\r
 \r
-/*\r
-uint32_t PackBits(uint8_t start, uint8_t len, uint8_t* bits){\r
+       /*\r
+     T55X7_DEFAULT_CONFIG_BLOCK, T55X7_RAW_CONFIG_BLOCK\r
+     T55X7_EM_UNIQUE_CONFIG_BLOCK, T55X7_FDXB_CONFIG_BLOCK,\r
+        T55X7_FDXB_CONFIG_BLOCK, T55X7_HID_26_CONFIG_BLOCK, T55X7_INDALA_64_CONFIG_BLOCK, T55X7_INDALA_224_CONFIG_BLOCK \r
+        T55X7_GUARDPROXII_CONFIG_BLOCK, T55X7_VIKING_CONFIG_BLOCK,     T55X7_NORALYS_CONFIG_BLOCK, T55X7_IOPROX_CONFIG_BLOCK   \r
+       */\r
+       static char buf[60];\r
+       char *retStr = buf;\r
        \r
-       int i = start;\r
-       int j = len-1;\r
-\r
-       if (len > 32) return 0;\r
-\r
-       uint32_t tmp = 0;\r
-       for (; j >= 0; --j, ++i)\r
-               tmp     |= bits[i] << j;\r
-\r
-       return tmp;\r
+       switch (id){\r
+               case 0: snprintf(retStr, sizeof(buf),"%08X - T55X7 Default", T55X7_DEFAULT_CONFIG_BLOCK); break;\r
+               case 1: snprintf(retStr, sizeof(buf),"%08X - T55X7 Raw", T55X7_RAW_CONFIG_BLOCK); break;\r
+               default:\r
+                       break;\r
+       }\r
+       PrintAndLog(buf);\r
 }\r
-*/\r
 \r
 int CmdResetRead(const char *Cmd) {\r
        UsbCommand c = {CMD_T55XX_RESET_READ, {0,0,0}};\r
@@ -1271,19 +1271,23 @@ int CmdResetRead(const char *Cmd) {
 int CmdT55xxWipe(const char *Cmd) {\r
        char writeData[20] = {0};\r
        char *ptrData = writeData;\r
-       uint8_t blk = 0;\r
+       \r
        PrintAndLog("\nBeginning Wipe of a T55xx tag (assuming the tag is not password protected)\n");\r
+       \r
        //try with the default password to reset block 0  (with a pwd should work even if pwd bit not set)\r
-       snprintf(ptrData,sizeof(writeData),"b %d d 00088040 p 0", blk);\r
-       if (!CmdT55xxWriteBlock(ptrData)){\r
-               PrintAndLog("Error writing blk %d", blk);\r
-       }\r
-       blk = 1;\r
-       for (; blk<8; blk++) {\r
+       snprintf(ptrData,sizeof(writeData),"b 0 d 000880E0 p 0");\r
+       \r
+       if (!CmdT55xxWriteBlock(ptrData))\r
+               PrintAndLog("Error writing blk 0");\r
+       \r
+       for (uint8_t blk = 1; blk<8; blk++) {\r
+               \r
                snprintf(ptrData,sizeof(writeData),"b %d d 0", blk);\r
-               if (!CmdT55xxWriteBlock(ptrData)){\r
+               \r
+               if (!CmdT55xxWriteBlock(ptrData)) \r
                        PrintAndLog("Error writing blk %d", blk);\r
-               }\r
+               \r
+               memset(writeData, sizeof(writeData), 0x00);\r
        }\r
        return 0;\r
 }\r
Impressum, Datenschutz