mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-03-16 01:53:02 +08:00
chg: 'lf visa2000 clone' - now verify successful write of blocks.
This commit is contained in:
parent
d5d273fedb
commit
cd28641d96
3 changed files with 32 additions and 23 deletions
|
@ -421,29 +421,28 @@ bool t55xxVerifyWrite(uint8_t block, bool page1, bool usepwd, uint8_t override,
|
|||
// this messes up with ppls config..
|
||||
if (block == 0 && page1 == false) {
|
||||
|
||||
PrintAndLogEx(INFO, "Block0 write detected, running `detect` to see if validation is possible (pwd == %08X)", password);
|
||||
|
||||
|
||||
PrintAndLogEx(INFO, "Block0 write detected, running `detect` to see if validation is possible");
|
||||
bool got_modulation = false;
|
||||
for ( uint8_t m = 0; m < 4; m++) {
|
||||
|
||||
if (AquireData(T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, true, password, m) == false) {
|
||||
PrintAndLogEx(INPLACE, ".");
|
||||
if (AquireData(T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, usepwd, password, m) == false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (tryDetectModulation(m, true) == false) {
|
||||
|
||||
if (tryDetectModulation(m, false) == false) {
|
||||
PrintAndLogEx(INPLACE, ".");
|
||||
continue;
|
||||
} else {
|
||||
got_modulation = true;
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
break;
|
||||
}
|
||||
}
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
|
||||
if (got_modulation == false)
|
||||
return false;
|
||||
|
||||
|
||||
return t55xxVerifyWrite(block, page1, usepwd, 2, password, downlink_mode, data);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,19 +11,6 @@
|
|||
|
||||
#include "cmdlfvisa2000.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "cmdparser.h" // command_t
|
||||
#include "comms.h"
|
||||
#include "ui.h"
|
||||
#include "graph.h"
|
||||
#include "cmddata.h"
|
||||
#include "cmdlf.h"
|
||||
#include "protocols.h" // for T55xx config register definitions
|
||||
#include "lfdemod.h" // parityTest
|
||||
|
||||
#define BL0CK1 0x56495332
|
||||
|
||||
static int CmdHelp(const char *Cmd);
|
||||
|
@ -171,7 +158,7 @@ static int CmdVisa2kClone(const char *Cmd) {
|
|||
id = param_get32ex(Cmd, 0, 0, 10);
|
||||
|
||||
//Q5
|
||||
if (param_getchar(Cmd, 1) == 'Q' || param_getchar(Cmd, 1) == 'q')
|
||||
if (tolower(param_getchar(Cmd, 1)) == 'q')
|
||||
blocks[0] = T5555_MODULATION_MANCHESTER | T5555_SET_BITRATE(64) | T5555_ST_TERMINATOR | 3 << T5555_MAXBLOCK_SHIFT;
|
||||
|
||||
blocks[2] = id;
|
||||
|
@ -180,8 +167,10 @@ static int CmdVisa2kClone(const char *Cmd) {
|
|||
PrintAndLogEx(INFO, "Preparing to clone Visa2000 to T55x7 with CardId: %u", id);
|
||||
print_blocks(blocks, 4);
|
||||
|
||||
uint8_t res = 0;
|
||||
|
||||
PacketResponseNG resp;
|
||||
|
||||
|
||||
// fast push mode
|
||||
conn.block_after_ACK = true;
|
||||
for (uint8_t i = 0; i < 4; i++) {
|
||||
|
@ -202,7 +191,16 @@ static int CmdVisa2kClone(const char *Cmd) {
|
|||
PrintAndLogEx(ERR, "Error occurred, device did not respond during write operation.");
|
||||
return PM3_ETIMEOUT;
|
||||
}
|
||||
|
||||
bool isok = t55xxVerifyWrite(i, 0, false, false, 0, 0, blocks[i]);
|
||||
if ( isok == false) {
|
||||
PrintAndLogEx(WARNING, "Couldn't verify write");
|
||||
res++;
|
||||
}
|
||||
}
|
||||
if ( res == 0 )
|
||||
PrintAndLogEx(SUCCESS, "Success writing to tag");
|
||||
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,19 @@
|
|||
#ifndef CMDLFVISA2000_H__
|
||||
#define CMDLFVISA2000_H__
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include "common.h"
|
||||
#include "cmdparser.h" // command_t
|
||||
#include "comms.h"
|
||||
#include "ui.h"
|
||||
#include "graph.h"
|
||||
#include "cmddata.h"
|
||||
#include "cmdlf.h"
|
||||
#include "protocols.h" // for T55xx config register definitions
|
||||
#include "lfdemod.h" // parityTest
|
||||
#include "cmdlft55xx.h" // write verify
|
||||
|
||||
int CmdLFVisa2k(const char *Cmd);
|
||||
|
||||
|
|
Loading…
Reference in a new issue