From c1c093af629c59ca2e541b888737c678fc59aed4 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Sat, 30 Apr 2022 00:04:49 +0200 Subject: [PATCH] Fixed support to clone Pyramic, Paradox and Awid on EM4x05 --- CHANGELOG.md | 1 + client/src/cmdlfawid.c | 9 +++++++++ client/src/cmdlfdestron.c | 1 + client/src/cmdlfhid.c | 1 + client/src/cmdlfparadox.c | 5 +++++ client/src/cmdlfpyramid.c | 5 +++++ 6 files changed, 22 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c8831a09..fb2ecb97d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file. This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log... ## [unreleased][unreleased] + - Fixed support to clone Pyramic, Paradox and Awid on EM4x05 (@doegox) - Added support to clone Viking and EM410x on EM4x05 (@doegox) - Fixed `lf config --reset` - averaging is set to 1 rather than 0 (@wh201906) - Added standalone mode for sniffing 14b (@jacopo-j) diff --git a/client/src/cmdlfawid.c b/client/src/cmdlfawid.c index 25c644800..6ccfa2cdf 100644 --- a/client/src/cmdlfawid.c +++ b/client/src/cmdlfawid.c @@ -373,6 +373,7 @@ static int CmdAWIDClone(const char *Cmd) { // EM4305 if (em) { + PrintAndLogEx(WARNING, "Beware some EM4305 tags don't support FSK and datarate = RF/50, check your tag copy!"); blocks[0] = EM4305_AWID_CONFIG_BLOCK; snprintf(cardtype, sizeof(cardtype), "EM4305/4469"); } @@ -391,6 +392,14 @@ static int CmdAWIDClone(const char *Cmd) { blocks[2] = bytebits_to_byte(bits + 32, 32); blocks[3] = bytebits_to_byte(bits + 64, 32); + // EM4305 + if (em) { + // invert FSK data + for (uint8_t i = 1; i < ARRAYLEN(blocks) ; i++) { + blocks[i] = blocks[i] ^ 0xFFFFFFFF; + } + } + free(bits); PrintAndLogEx(INFO, "Preparing to clone AWID %u to " _YELLOW_("%s") " with FC: " _GREEN_("%u") " CN: " _GREEN_("%u"), fmtlen, cardtype, fc, cn); diff --git a/client/src/cmdlfdestron.c b/client/src/cmdlfdestron.c index 8fe5aac3a..aaca79ff8 100644 --- a/client/src/cmdlfdestron.c +++ b/client/src/cmdlfdestron.c @@ -182,6 +182,7 @@ static int CmdDestronClone(const char *Cmd) { // EM4305 if (em) { + PrintAndLogEx(WARNING, "Beware some EM4305 tags don't support FSK and datarate = RF/50, check your tag copy!"); blocks[0] = EM4305_DESTRON_CONFIG_BLOCK; snprintf(cardtype, sizeof(cardtype), "EM4305/4469"); } diff --git a/client/src/cmdlfhid.c b/client/src/cmdlfhid.c index e78c83596..d25c06811 100644 --- a/client/src/cmdlfhid.c +++ b/client/src/cmdlfhid.c @@ -419,6 +419,7 @@ static int CmdHIDClone(const char *Cmd) { // EM4305 if (em) { + PrintAndLogEx(WARNING, "Beware some EM4305 tags don't support FSK and datarate = RF/50, check your tag copy!"); snprintf(cardtype, sizeof(cardtype), "EM4305/4469"); } diff --git a/client/src/cmdlfparadox.c b/client/src/cmdlfparadox.c index a2ce045b0..ebfad9a0e 100644 --- a/client/src/cmdlfparadox.c +++ b/client/src/cmdlfparadox.c @@ -275,7 +275,12 @@ static int CmdParadoxClone(const char *Cmd) { // EM4305 if (em) { + PrintAndLogEx(WARNING, "Beware some EM4305 tags don't support FSK and datarate = RF/50, check your tag copy!"); blocks[0] = EM4305_PARADOX_CONFIG_BLOCK; + // invert FSK data + for (uint8_t i = 1; i < ARRAYLEN(blocks); i++) { + blocks[i] = blocks[i] ^ 0xFFFFFFFF; + } snprintf(cardtype, sizeof(cardtype), "EM4305/4469"); } diff --git a/client/src/cmdlfpyramid.c b/client/src/cmdlfpyramid.c index da25c34a8..c0f9e8111 100644 --- a/client/src/cmdlfpyramid.c +++ b/client/src/cmdlfpyramid.c @@ -327,7 +327,12 @@ static int CmdPyramidClone(const char *Cmd) { } // EM4305 if (em) { + PrintAndLogEx(WARNING, "Beware some EM4305 tags don't support FSK and datarate = RF/50, check your tag copy!"); blocks[0] = EM4305_PYRAMID_CONFIG_BLOCK; + // invert FSK data + for (uint8_t i = 1; i < ARRAYLEN(blocks) ; i++) { + blocks[i] = blocks[i] ^ 0xFFFFFFFF; + } snprintf(cardtype, sizeof(cardtype), "EM4305/4469"); }