From 44cb67c49b16e4d9d1085436457c025aabf9a2d0 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Sun, 15 Sep 2019 20:27:50 +0200 Subject: [PATCH] adjusting write validation to only print when successful in validating. Otherwise like old times. silence. --- client/cmdlfpresco.c | 29 ++++++++++++++++------------- client/cmdlfpresco.h | 14 ++++++++++++++ client/cmdlfpyramid.c | 14 ++++++++------ client/cmdlfvisa2000.c | 13 +++++++------ 4 files changed, 45 insertions(+), 25 deletions(-) diff --git a/client/cmdlfpresco.c b/client/cmdlfpresco.c index 14d87648e..a9c74d9ac 100644 --- a/client/cmdlfpresco.c +++ b/client/cmdlfpresco.c @@ -9,19 +9,6 @@ #include "cmdlfpresco.h" -#include -#include -#include -#include - -#include "cmdparser.h" // command_t -#include "comms.h" -#include "ui.h" -#include "cmddata.h" -#include "cmdlf.h" -#include "protocols.h" // for T55xx config register definitions -#include "lfdemod.h" // parityTest - static int CmdHelp(const char *Cmd); static int usage_lf_presco_clone(void) { @@ -134,6 +121,7 @@ static int CmdPrescoClone(const char *Cmd) { PrintAndLogEx(INFO, "Preparing to clone Presco to T55x7 with SiteCode: %u, UserCode: %u, FullCode: %08x", sitecode, usercode, fullcode); print_blocks(blocks, 5); + uint8_t res = 0; PacketResponseNG resp; // fast push mode @@ -155,7 +143,22 @@ static int CmdPrescoClone(const char *Cmd) { PrintAndLogEx(ERR, "Error occurred, device did not respond during write operation."); return PM3_ETIMEOUT; } + + // write block0, needs a detect. + if (i == 0) { + printf("enter detect "); + bool ok = t55xxAquireAndDetect(false, 0, blocks[i], false); + printf(" b0 = '%c' \n", (ok) ? 'Y':'N'); + } + if (t55xxVerifyWrite(i, 0, false, false, 0, 0xFF, blocks[i]) == false) { + res++; + printf(" i = %d \n", i); + } } + + if ( res == 0 ) + PrintAndLogEx(SUCCESS, "Success writing to tag"); + return PM3_SUCCESS; } diff --git a/client/cmdlfpresco.h b/client/cmdlfpresco.h index 098a98342..8f7c7eb31 100644 --- a/client/cmdlfpresco.h +++ b/client/cmdlfpresco.h @@ -11,6 +11,20 @@ #include "common.h" +#include +#include +#include +#include + +#include "cmdparser.h" // command_t +#include "comms.h" +#include "ui.h" +#include "cmddata.h" +#include "cmdlf.h" +#include "protocols.h" // for T55xx config register definitions +#include "lfdemod.h" // parityTest +#include "cmdlft55xx.h" // verifywrite + int CmdLFPresco(const char *Cmd); int demodPresco(void); diff --git a/client/cmdlfpyramid.c b/client/cmdlfpyramid.c index 90a4ccfde..d0f116bf4 100644 --- a/client/cmdlfpyramid.c +++ b/client/cmdlfpyramid.c @@ -236,8 +236,8 @@ static int CmdPyramidClone(const char *Cmd) { // fast push mode conn.block_after_ACK = true; - for (int8_t i = 4; i >= 0; i--) { - if (i == 0) { + for (int8_t i = 0; i < 5; i++) { + if (i == 4) { // Disable fast mode on last packet conn.block_after_ACK = false; } @@ -254,11 +254,13 @@ static int CmdPyramidClone(const char *Cmd) { return PM3_ETIMEOUT; } - bool isok = t55xxVerifyWrite(i, 0, false, false, 0, 0, blocks[i]); - if ( isok == false) { - PrintAndLogEx(WARNING, "Couldn't verify write"); + // write block0, needs a detect. + if (i == 0) + t55xxAquireAndDetect(false, 0, blocks[i], false); + + if (t55xxVerifyWrite(i, 0, false, false, 0, 0xFF, blocks[i]) == false) res++; - } + } if ( res == 0 ) diff --git a/client/cmdlfvisa2000.c b/client/cmdlfvisa2000.c index 1433ced01..51cedb925 100644 --- a/client/cmdlfvisa2000.c +++ b/client/cmdlfvisa2000.c @@ -168,7 +168,6 @@ static int CmdVisa2kClone(const char *Cmd) { print_blocks(blocks, 4); uint8_t res = 0; - PacketResponseNG resp; // fast push mode @@ -190,14 +189,16 @@ static int CmdVisa2kClone(const char *Cmd) { PrintAndLogEx(ERR, "Error occurred, device did not respond during write operation."); return PM3_ETIMEOUT; - } + } + + // write block0, needs a detect. + if (i == 0) + t55xxAquireAndDetect(false, 0, blocks[i], false); - bool isok = t55xxVerifyWrite(i, 0, false, false, 0, 0, blocks[i]); - if ( isok == false) { - PrintAndLogEx(WARNING, "Couldn't verify write"); + if (t55xxVerifyWrite(i, 0, false, false, 0, 0xFF, blocks[i]) == false) res++; - } } + if ( res == 0 ) PrintAndLogEx(SUCCESS, "Success writing to tag");