From 4b55047c5ba5a1645ecdaf824b22cc1acf8a68eb Mon Sep 17 00:00:00 2001 From: merlokk <807634+merlokk@users.noreply.github.com> Date: Mon, 18 Jul 2022 09:47:15 +0300 Subject: [PATCH 1/4] add mmbit --- client/src/cmdhftexkom.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/client/src/cmdhftexkom.c b/client/src/cmdhftexkom.c index 18a1f5c48..41a0ecf52 100644 --- a/client/src/cmdhftexkom.c +++ b/client/src/cmdhftexkom.c @@ -191,6 +191,13 @@ static uint8_t TexcomTK13CRC(const uint8_t *data) { return crc; } +static uint8_t MMBITCRC(const uint8_t *data) { + return + (data[0] & 0x0f) ^ ((data[0] >> 4) & 0x0f) ^ + (data[1] & 0x0f) ^ ((data[1] >> 4) & 0x0f) ^ + (data[2] & 0x0f) ^ ((data[2] >> 4) & 0x0f); +} + static unsigned char dallas_crc8(const unsigned char *data, const unsigned int size) { unsigned char crc = 0; for (unsigned int i = 0; i < size; ++i) { @@ -539,6 +546,13 @@ int read_texkom_uid(bool loop, bool verbose) { if (verbose) { PrintAndLogEx(INFO, "CRC...... %s", (crc) ? _GREEN_("ok") : _RED_("fail")); } + } else if (card.tcode[2] == 0xFF && card.tcode[3] == 0xFF) { + PrintAndLogEx(INFO, "TYPE..... MMBIT"); + PrintAndLogEx(INFO, "UID...... " _GREEN_("%s"), sprint_hex(&card.tcode[4], 3)); + crc = (MMBITCRC(&card.tcode[4]) == card.tcode[7] >> 4); + if (verbose) { + PrintAndLogEx(INFO, "CRC...... %s", (crc) ? _GREEN_("ok") : _RED_("fail")); + } } if (verbose) { PrintAndLogEx(INFO, "Raw... %s", sprint_hex(card.tcode, 8)); From 29086a42ab9f6b60b5cc3d92a5d3c5401b5e56c5 Mon Sep 17 00:00:00 2001 From: merlokk <807634+merlokk@users.noreply.github.com> Date: Mon, 18 Jul 2022 09:59:13 +0300 Subject: [PATCH 2/4] add check in the read command --- client/src/cmdhftexkom.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/client/src/cmdhftexkom.c b/client/src/cmdhftexkom.c index 41a0ecf52..07ca40d29 100644 --- a/client/src/cmdhftexkom.c +++ b/client/src/cmdhftexkom.c @@ -721,6 +721,18 @@ static int CmdHFTexkomReader(const char *Cmd) { else PrintAndLogEx(WARNING, "crc : WRONG"); + } else if (tcode[2] == 0xFF && tcode[3] == 0xFF) { + // MMBIT + if (codefound != TexkomModTK13) { + PrintAndLogEx(WARNING, " mod type: WRONG"); + } + PrintAndLogEx(INFO, "type : MMBIT"); + PrintAndLogEx(INFO, "uid : %s", sprint_hex(&tcode[4], 3)); + + if (MMBITCRC(&tcode[4]) == tcode[7] >> 4) + PrintAndLogEx(INFO, "crc : OK"); + else + PrintAndLogEx(WARNING, "crc : WRONG"); } else if (tcode[2] == 0xCA) { // TK17 if (codefound != TexkomModTK17) { From 075c53096240e056df62c8f457930799e5ad242b Mon Sep 17 00:00:00 2001 From: merlokk <807634+merlokk@users.noreply.github.com> Date: Mon, 18 Jul 2022 10:11:13 +0300 Subject: [PATCH 3/4] fix crc --- client/src/cmdhftexkom.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/client/src/cmdhftexkom.c b/client/src/cmdhftexkom.c index 07ca40d29..b62460e6c 100644 --- a/client/src/cmdhftexkom.c +++ b/client/src/cmdhftexkom.c @@ -193,9 +193,11 @@ static uint8_t TexcomTK13CRC(const uint8_t *data) { static uint8_t MMBITCRC(const uint8_t *data) { return - (data[0] & 0x0f) ^ ((data[0] >> 4) & 0x0f) ^ - (data[1] & 0x0f) ^ ((data[1] >> 4) & 0x0f) ^ - (data[2] & 0x0f) ^ ((data[2] >> 4) & 0x0f); + (( (data[0] & 0x0f) ^ ((data[0] >> 4) & 0x0f) ^ + (data[1] & 0x0f) ^ ((data[1] >> 4) & 0x0f) ^ + (data[2] & 0x0f) ^ ((data[2] >> 4) & 0x0f) + ) ^ 0x0f + ) & 0x0f; } static unsigned char dallas_crc8(const unsigned char *data, const unsigned int size) { From d153c6c9776633d6532253fc643b1d0b8d33f3bd Mon Sep 17 00:00:00 2001 From: merlokk <807634+merlokk@users.noreply.github.com> Date: Mon, 18 Jul 2022 10:17:44 +0300 Subject: [PATCH 4/4] add changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0bc8e9ece..bd3d91adf 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] + - Added mmbit-002 (kibi-002, kb5004xk1) russian tag to `hf texkom read` command (@merlokk) - Added `hf sniff --smode` skip/group adc data to consume less memory. Now it can sniff very long signals (@merlokk) - Added `hf fudan` skeleton commands (@iceman1001) - Added `--reboot-to-bootloader` arg to pm3