mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 21:33:47 -07:00
chg clone
This commit is contained in:
parent
e370d60171
commit
0a967f7733
2 changed files with 19 additions and 55 deletions
|
@ -9,6 +9,20 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
#include "cmdlfnoralsy.h"
|
#include "cmdlfnoralsy.h"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#include "commonutil.h" // ARRAYLEN
|
||||||
|
#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
|
||||||
|
|
||||||
static int CmdHelp(const char *Cmd);
|
static int CmdHelp(const char *Cmd);
|
||||||
|
|
||||||
static int usage_lf_noralsy_clone(void) {
|
static int usage_lf_noralsy_clone(void) {
|
||||||
|
@ -128,8 +142,7 @@ static int CmdNoralsyClone(const char *Cmd) {
|
||||||
uint16_t year = 0;
|
uint16_t year = 0;
|
||||||
uint32_t id = 0;
|
uint32_t id = 0;
|
||||||
uint32_t blocks[4] = {T55x7_MODULATION_MANCHESTER | T55x7_BITRATE_RF_32 | T55x7_ST_TERMINATOR | 3 << T55x7_MAXBLOCK_SHIFT, 0, 0};
|
uint32_t blocks[4] = {T55x7_MODULATION_MANCHESTER | T55x7_BITRATE_RF_32 | T55x7_ST_TERMINATOR | 3 << T55x7_MAXBLOCK_SHIFT, 0, 0};
|
||||||
uint8_t bits[96];
|
uint8_t *bits = calloc(96, sizeof(uint8_t));
|
||||||
memset(bits, 0, sizeof(bits));
|
|
||||||
|
|
||||||
char cmdp = tolower(param_getchar(Cmd, 0));
|
char cmdp = tolower(param_getchar(Cmd, 0));
|
||||||
if (strlen(Cmd) == 0 || cmdp == 'h') return usage_lf_noralsy_clone();
|
if (strlen(Cmd) == 0 || cmdp == 'h') return usage_lf_noralsy_clone();
|
||||||
|
@ -146,52 +159,16 @@ static int CmdNoralsyClone(const char *Cmd) {
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
blocks[1] = bytebits_to_byte(bits, 32);
|
blocks[1] = bytebits_to_byte(bits, 32);
|
||||||
blocks[2] = bytebits_to_byte(bits + 32, 32);
|
blocks[2] = bytebits_to_byte(bits + 32, 32);
|
||||||
blocks[3] = bytebits_to_byte(bits + 64, 32);
|
blocks[3] = bytebits_to_byte(bits + 64, 32);
|
||||||
|
|
||||||
|
free(bits);
|
||||||
|
|
||||||
PrintAndLogEx(INFO, "Preparing to clone Noralsy to T55x7 with CardId: %u", id);
|
PrintAndLogEx(INFO, "Preparing to clone Noralsy to T55x7 with CardId: %u", id);
|
||||||
print_blocks(blocks, 4);
|
print_blocks(blocks, ARRAYLEN(blocks));
|
||||||
|
|
||||||
uint8_t res = 0;
|
return clone_t55xx_tag(blocks, ARRAYLEN(blocks));}
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int CmdNoralsySim(const char *Cmd) {
|
static int CmdNoralsySim(const char *Cmd) {
|
||||||
|
|
||||||
|
|
|
@ -11,19 +11,6 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include <string.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 CmdLFNoralsy(const char *Cmd);
|
int CmdLFNoralsy(const char *Cmd);
|
||||||
|
|
||||||
int demodNoralsy(void);
|
int demodNoralsy(void);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue