mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 10:37:23 -07:00
chg rework t55x7 clone..
This commit is contained in:
parent
563f6bee47
commit
40e793eb1a
4 changed files with 32 additions and 64 deletions
|
@ -11,6 +11,22 @@
|
|||
|
||||
#include "cmdlfvisa2000.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "commonutil.h" // ARRAYLEN
|
||||
#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
|
||||
|
||||
#define BL0CK1 0x56495332
|
||||
|
||||
static int CmdHelp(const char *Cmd);
|
||||
|
@ -165,46 +181,9 @@ static int CmdVisa2kClone(const char *Cmd) {
|
|||
blocks[3] = (visa_parity(id) << 4) | visa_chksum(id);
|
||||
|
||||
PrintAndLogEx(INFO, "Preparing to clone Visa2000 to T55x7 with CardId: %u", id);
|
||||
print_blocks(blocks, 4);
|
||||
print_blocks(blocks, ARRAYLEN(blocks));
|
||||
|
||||
uint8_t res = 0;
|
||||
PacketResponseNG resp;
|
||||
|
||||
// fast push mode
|
||||
conn.block_after_ACK = true;
|
||||
for (uint8_t i = 0; i < 4; i++) {
|
||||
if (i == 3) {
|
||||
// Disable fast mode on last packet
|
||||
conn.block_after_ACK = false;
|
||||
}
|
||||
clearCommandBuffer();
|
||||
t55xx_write_block_t ng;
|
||||
ng.data = blocks[i];
|
||||
ng.pwd = 0;
|
||||
ng.blockno = i;
|
||||
ng.flags = 0;
|
||||
|
||||
SendCommandNG(CMD_LF_T55XX_WRITEBL, (uint8_t *)&ng, sizeof(ng));
|
||||
if (!WaitForResponseTimeout(CMD_LF_T55XX_WRITEBL, &resp, T55XX_WRITE_TIMEOUT)) {
|
||||
|
||||
PrintAndLogEx(ERR, "Error occurred, device did not respond during write operation.");
|
||||
return PM3_ETIMEOUT;
|
||||
}
|
||||
|
||||
if (i == 0) {
|
||||
SetConfigWithBlock0(blocks[0]);
|
||||
if (t55xxAquireAndCompareBlock0(false, 0, blocks[0], false))
|
||||
continue;
|
||||
}
|
||||
|
||||
if (t55xxVerifyWrite(i, 0, false, false, 0, 0xFF, blocks[i]) == false)
|
||||
res++;
|
||||
}
|
||||
|
||||
if (res == 0)
|
||||
PrintAndLogEx(SUCCESS, "Success writing to tag");
|
||||
|
||||
return PM3_SUCCESS;
|
||||
return clone_t55xx_tag(blocks, ARRAYLEN(blocks));
|
||||
}
|
||||
|
||||
static int CmdVisa2kSim(const char *Cmd) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue