]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdlft55xx.c
ADD: some more keys found on a pastebin
[proxmark3-svn] / client / cmdlft55xx.c
index 1cadfe7a6b1cda5ce6f27d75fc4c25c26effe1d7..3b56881b7247cf459b47fab12492956bb99ba58d 100644 (file)
@@ -28,6 +28,7 @@
 \r
 #define CONFIGURATION_BLOCK 0x00\r
 #define TRACE_BLOCK 0x01\r
+#define T55x7_PWD      0x00000010\r
 \r
 // Default configuration\r
 t55xx_conf_block_t config = { .modulation = DEMOD_ASK, .inverted = FALSE, .offset = 0x00, .block0 = 0x00};\r
@@ -235,8 +236,20 @@ int CmdT55xxReadBlock(const char *Cmd) {
 \r
        //Password mode\r
        if ( res == 2 ) {\r
-               c.arg[2] = password;\r
-               c.d.asBytes[0] = 0x1; \r
+               \r
+               // try reading the config block and verify that PWD bit is set before doing this!\r
+               AquireData( CONFIGURATION_BLOCK );\r
+               if ( !tryDetectModulation() ) {\r
+                       PrintAndLog("Could not detect is PWD bit is set in config block. Exits.");\r
+                       return 1;\r
+               }\r
+               //if PWD bit is set,  allow to execute read command with password.\r
+               if (( config.block0 & T55x7_PWD ) == 1) {\r
+                       c.arg[2] = password;\r
+                       c.d.asBytes[0] = 0x1;                   \r
+               } else {                \r
+                       PrintAndLog("PWD bit is NOT set in config block. Reading without password...");\r
+               }\r
        }\r
 \r
        clearCommandBuffer();\r
@@ -249,8 +262,8 @@ int CmdT55xxReadBlock(const char *Cmd) {
        uint8_t got[12000];\r
        GetFromBigBuf(got,sizeof(got),0);\r
        WaitForResponse(CMD_ACK,NULL);\r
-       setGraphBuf(got, 12000);\r
-       DemodBufferLen=0;\r
+       setGraphBuf(got, sizeof(got));\r
+       //DemodBufferLen=0;\r
        if (!DecodeT55xxBlock()) return 3;\r
        char blk[10]={0};\r
        sprintf(blk,"%d", block);\r
@@ -667,8 +680,8 @@ int CmdT55xxWriteBlock(const char *Cmd)
                return 1;\r
        }\r
        \r
-       UsbCommand resp;\r
        UsbCommand c = {CMD_T55XX_WRITE_BLOCK, {data, block, 0}};\r
+       UsbCommand resp;\r
        c.d.asBytes[0] = 0x0; \r
 \r
        PrintAndLog("Writing to block: %d  data  : 0x%08X", block, data);\r
Impressum, Datenschutz