]> cvs.zerfleddert.de Git - proxmark3-svn/commitdiff
FIX: a suggested fix for #136 where the "lf t55x7 read" command when called with...
authoriceman1001 <iceman@iuse.se>
Thu, 15 Oct 2015 17:17:20 +0000 (19:17 +0200)
committericeman1001 <iceman@iuse.se>
Thu, 15 Oct 2015 17:17:20 +0000 (19:17 +0200)
If PWD Bit is set,  the call will be allowed to execute.
If PWD Bit is NOT set,  the call will print a message and excute the call but without sending the password.
If config block is not being able to read or decode,   the call with print a warning message and exit the call.

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