adjusting write validation to only print when successful in validating. Otherwise like old times. silence.

This commit is contained in:
iceman1001 2019-09-15 20:27:50 +02:00
parent 960d8c4db3
commit 44cb67c49b
4 changed files with 45 additions and 25 deletions

View file

@ -9,19 +9,6 @@
#include "cmdlfpresco.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#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;
}

View file

@ -11,6 +11,20 @@
#include "common.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#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);

View file

@ -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 )

View file

@ -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");