]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdlft55xx.c
test
[proxmark3-svn] / client / cmdlft55xx.c
index 1cadfe7a6b1cda5ce6f27d75fc4c25c26effe1d7..e652c788589a43173dfd7b16c5bec5e78e5aa21a 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
Impressum, Datenschutz