X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/ac2df3460ab2ab2d39fe93350018701699d8327b..2f5436ff0d860267c3f5419ac218da474dff64f1:/client/cmdlft55xx.c diff --git a/client/cmdlft55xx.c b/client/cmdlft55xx.c index 1cadfe7a..e652c788 100644 --- a/client/cmdlft55xx.c +++ b/client/cmdlft55xx.c @@ -28,6 +28,7 @@ #define CONFIGURATION_BLOCK 0x00 #define TRACE_BLOCK 0x01 +#define T55x7_PWD 0x00000010 // Default configuration t55xx_conf_block_t config = { .modulation = DEMOD_ASK, .inverted = FALSE, .offset = 0x00, .block0 = 0x00}; @@ -235,8 +236,20 @@ int CmdT55xxReadBlock(const char *Cmd) { //Password mode if ( res == 2 ) { - c.arg[2] = password; - c.d.asBytes[0] = 0x1; + + // try reading the config block and verify that PWD bit is set before doing this! + AquireData( CONFIGURATION_BLOCK ); + if ( !tryDetectModulation() ) { + PrintAndLog("Could not detect is PWD bit is set in config block. Exits."); + return 1; + } + //if PWD bit is set, allow to execute read command with password. + if (( config.block0 & T55x7_PWD ) == 1) { + c.arg[2] = password; + c.d.asBytes[0] = 0x1; + } else { + PrintAndLog("PWD bit is NOT set in config block. Reading without password..."); + } } clearCommandBuffer();