Merge pull request #1717 from merlokk/tk_mmbit

add mmbit
This commit is contained in:
Oleg Moiseenko 2022-07-18 11:39:49 +03:00 committed by GitHub
commit 1e1b669297
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 0 deletions

View file

@ -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... 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] ## [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 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 `hf fudan` skeleton commands (@iceman1001)
- Added `--reboot-to-bootloader` arg to pm3 - Added `--reboot-to-bootloader` arg to pm3

View file

@ -191,6 +191,15 @@ static uint8_t TexcomTK13CRC(const uint8_t *data) {
return crc; 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)
) ^ 0x0f
) & 0x0f;
}
static unsigned char dallas_crc8(const unsigned char *data, const unsigned int size) { static unsigned char dallas_crc8(const unsigned char *data, const unsigned int size) {
unsigned char crc = 0; unsigned char crc = 0;
for (unsigned int i = 0; i < size; ++i) { for (unsigned int i = 0; i < size; ++i) {
@ -539,6 +548,13 @@ int read_texkom_uid(bool loop, bool verbose) {
if (verbose) { if (verbose) {
PrintAndLogEx(INFO, "CRC...... %s", (crc) ? _GREEN_("ok") : _RED_("fail")); 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) { if (verbose) {
PrintAndLogEx(INFO, "Raw... %s", sprint_hex(card.tcode, 8)); PrintAndLogEx(INFO, "Raw... %s", sprint_hex(card.tcode, 8));
@ -707,6 +723,18 @@ static int CmdHFTexkomReader(const char *Cmd) {
else else
PrintAndLogEx(WARNING, "crc : WRONG"); 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) { } else if (tcode[2] == 0xCA) {
// TK17 // TK17
if (codefound != TexkomModTK17) { if (codefound != TexkomModTK17) {