mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07:00
chg: 'lf viking clone' - now uses NG
This commit is contained in:
parent
cd28641d96
commit
2bec009778
5 changed files with 50 additions and 24 deletions
|
@ -856,7 +856,12 @@ static void PacketReceived(PacketCommandNG *packet) {
|
|||
break;
|
||||
}
|
||||
case CMD_LF_VIKING_CLONE: {
|
||||
CopyVikingtoT55xx(packet->oldarg[0], packet->oldarg[1], packet->oldarg[2]);
|
||||
struct p {
|
||||
bool Q5;
|
||||
uint8_t blocks[8];
|
||||
} PACKED;
|
||||
struct p *payload = (struct p*)packet->data.asBytes;
|
||||
CopyVikingtoT55xx(payload->blocks, payload->Q5);
|
||||
break;
|
||||
}
|
||||
case CMD_LF_COTAG_READ: {
|
||||
|
@ -1217,7 +1222,11 @@ static void PacketReceived(PacketCommandNG *packet) {
|
|||
break;
|
||||
}
|
||||
case CMD_HF_ICLASS_READER: {
|
||||
ReaderIClass(packet->oldarg[0]);
|
||||
struct p {
|
||||
uint8_t flags;
|
||||
} PACKED;
|
||||
struct p *payload = (struct p *)packet->data.asBytes;
|
||||
ReaderIClass(payload->flags);
|
||||
break;
|
||||
}
|
||||
case CMD_HF_ICLASS_REPLAY: {
|
||||
|
|
|
@ -2152,13 +2152,19 @@ void CopyIndala224toT55x7(uint32_t uid1, uint32_t uid2, uint32_t uid3, uint32_t
|
|||
LED_D_OFF();
|
||||
}
|
||||
// clone viking tag to T55xx
|
||||
void CopyVikingtoT55xx(uint32_t block1, uint32_t block2, uint8_t Q5) {
|
||||
uint32_t data[] = {T55x7_BITRATE_RF_32 | T55x7_MODULATION_MANCHESTER | (2 << T55x7_MAXBLOCK_SHIFT), block1, block2};
|
||||
if (Q5) data[0] = T5555_SET_BITRATE(32) | T5555_MODULATION_MANCHESTER | 2 << T5555_MAXBLOCK_SHIFT;
|
||||
void CopyVikingtoT55xx(uint8_t *blocks, uint8_t Q5) {
|
||||
|
||||
uint32_t data[] = {T55x7_BITRATE_RF_32 | T55x7_MODULATION_MANCHESTER | (2 << T55x7_MAXBLOCK_SHIFT), 0, 0};
|
||||
if (Q5)
|
||||
data[0] = T5555_SET_BITRATE(32) | T5555_MODULATION_MANCHESTER | 2 << T5555_MAXBLOCK_SHIFT;
|
||||
|
||||
data[1] = bytes_to_num(blocks, 4);
|
||||
data[2] = bytes_to_num(blocks +4, 4);
|
||||
|
||||
// Program the data blocks for supplied ID and the block 0 config
|
||||
WriteT55xx(data, 0, 3);
|
||||
LED_D_OFF();
|
||||
reply_mix(CMD_ACK, 0, 0, 0, 0, 0);
|
||||
reply_ng(CMD_LF_VIKING_CLONE, PM3_SUCCESS, NULL, 0);
|
||||
}
|
||||
|
||||
// Define 9bit header for EM410x tags
|
||||
|
|
|
@ -43,7 +43,7 @@ void CmdEM410xdemod(int findone, uint32_t *high, uint64_t *low, int ledcontrol);
|
|||
void CmdIOdemodFSK(int findone, uint32_t *high, uint32_t *low, int ledcontrol);
|
||||
void CopyIOtoT55x7(uint32_t hi, uint32_t lo); // Clone an ioProx card to T5557/T5567
|
||||
void CopyHIDtoT55x7(uint32_t hi2, uint32_t hi, uint32_t lo, uint8_t longFMT); // Clone an HID card to T5557/T5567
|
||||
void CopyVikingtoT55xx(uint32_t block1, uint32_t block2, uint8_t Q5);
|
||||
void CopyVikingtoT55xx(uint8_t *blocks, uint8_t Q5);
|
||||
void WriteEM410x(uint32_t card, uint32_t id_hi, uint32_t id_lo);
|
||||
void CopyIndala64toT55x7(uint32_t hi, uint32_t lo); // Clone Indala 64-bit tag by UID to T55x7
|
||||
void CopyIndala224toT55x7(uint32_t uid1, uint32_t uid2, uint32_t uid3, uint32_t uid4, uint32_t uid5, uint32_t uid6, uint32_t uid7); // Clone Indala 224-bit tag by UID to T55x7
|
||||
|
|
|
@ -9,17 +9,6 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
#include "cmdlfviking.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 "lfdemod.h"
|
||||
|
||||
static int CmdHelp(const char *Cmd);
|
||||
|
||||
static int usage_lf_viking_clone(void) {
|
||||
|
@ -90,22 +79,31 @@ static int CmdVikingClone(const char *Cmd) {
|
|||
id = param_get32ex(Cmd, 0, 0, 16);
|
||||
if (id == 0) return usage_lf_viking_clone();
|
||||
|
||||
cmdp = param_getchar(Cmd, 1);
|
||||
if (cmdp == 'Q' || cmdp == 'q')
|
||||
cmdp = tolower(param_getchar(Cmd, 1));
|
||||
if (cmdp == 'q')
|
||||
Q5 = true;
|
||||
|
||||
rawID = getVikingBits(id);
|
||||
|
||||
PrintAndLogEx(INFO, "Preparing to clone Viking tag - ID " _YELLOW_("%08X")" raw " _YELLOW_("%08X%08X"), id, (uint32_t)(rawID >> 32), (uint32_t)(rawID & 0xFFFFFFFF));
|
||||
struct p {
|
||||
bool Q5;
|
||||
uint8_t blocks[8];
|
||||
} PACKED payload;
|
||||
payload.Q5 = Q5;
|
||||
|
||||
num_to_bytes(rawID, 8, &payload.blocks[0]);
|
||||
|
||||
PrintAndLogEx(INFO, "Preparing to clone Viking tag - ID " _YELLOW_("%08X")" raw " _YELLOW_("%s"), id, sprint_hex(payload.blocks, sizeof(payload.blocks)));
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_LF_VIKING_CLONE, rawID >> 32, rawID & 0xFFFFFFFF, Q5, NULL, 0);
|
||||
|
||||
SendCommandNG(CMD_LF_VIKING_CLONE, (uint8_t*)&payload, sizeof(payload));
|
||||
PacketResponseNG resp;
|
||||
if (!WaitForResponseTimeout(CMD_ACK, &resp, T55XX_WRITE_TIMEOUT)) {
|
||||
if (!WaitForResponseTimeout(CMD_LF_VIKING_CLONE, &resp, T55XX_WRITE_TIMEOUT)) {
|
||||
PrintAndLogEx(ERR, "Error occurred, device did not respond during write operation.");
|
||||
return PM3_ETIMEOUT;
|
||||
}
|
||||
return PM3_SUCCESS;
|
||||
return resp.status;
|
||||
}
|
||||
|
||||
static int CmdVikingSim(const char *Cmd) {
|
||||
|
|
|
@ -9,8 +9,21 @@
|
|||
#ifndef CMDLFVIKING_H__
|
||||
#define CMDLFVIKING_H__
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include "cmdparser.h" // command_t
|
||||
#include "comms.h"
|
||||
#include "ui.h"
|
||||
#include "cmddata.h"
|
||||
#include "cmdlf.h"
|
||||
#include "lfdemod.h"
|
||||
#include "commonutil.h" // num_to_bytes
|
||||
|
||||
|
||||
int CmdLFViking(const char *Cmd);
|
||||
|
||||
int demodViking(void);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue