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.
\r
#define CONFIGURATION_BLOCK 0x00\r
#define TRACE_BLOCK 0x01\r
\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
\r
// Default configuration\r
t55xx_conf_block_t config = { .modulation = DEMOD_ASK, .inverted = FALSE, .offset = 0x00, .block0 = 0x00};\r
\r
//Password mode\r
if ( res == 2 ) {\r
\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
}\r
\r
clearCommandBuffer();\r