diff --git a/client/src/cmdhfmf.c b/client/src/cmdhfmf.c index 1b1291bb1..5becf435b 100644 --- a/client/src/cmdhfmf.c +++ b/client/src/cmdhfmf.c @@ -5538,11 +5538,11 @@ static int CmdHF14AMfCLoad(const char *Cmd) { return PM3_EFILE; } - PrintAndLogEx(SUCCESS, - "Card loaded " _YELLOW_("%d") " blocks from %s" - , block_cnt - , (fill_from_emulator ? "emulator memory" : "file") - ); + PrintAndLogEx(SUCCESS, + "Card loaded " _YELLOW_("%d") " blocks from %s" + , block_cnt + , (fill_from_emulator ? "emulator memory" : "file") + ); PrintAndLogEx(INFO, "Done!"); return PM3_SUCCESS; } @@ -8436,11 +8436,11 @@ static int CmdHF14AGen4Load(const char *cmd) { free(data); } - PrintAndLogEx(SUCCESS, - "Card loaded " _YELLOW_("%d") " blocks from %s" - , end - start + 1 - , (fill_from_emulator ? "emulator memory" : "file") - ); + PrintAndLogEx(SUCCESS, + "Card loaded " _YELLOW_("%d") " blocks from %s" + , end - start + 1 + , (fill_from_emulator ? "emulator memory" : "file") + ); PrintAndLogEx(INFO, "Done!"); return PM3_SUCCESS; } diff --git a/client/src/cmdwiegand.c b/client/src/cmdwiegand.c index 82d6ce14c..e6ae43629 100644 --- a/client/src/cmdwiegand.c +++ b/client/src/cmdwiegand.c @@ -213,7 +213,8 @@ int CmdWiegandDecode(const char *Cmd) { } PrintAndLogEx(NORMAL, ""); - PrintAndLogEx(INFO, "Wiegand decode"); + PrintAndLogEx(INFO, "------------------------- " _CYAN_("Wiegand") " ---------------------------"); + decode_wiegand(top, mid, bot, blen); return PM3_SUCCESS; } diff --git a/client/src/wiegand_formats.c b/client/src/wiegand_formats.c index b538f6fdc..05e6f0d7c 100644 --- a/client/src/wiegand_formats.c +++ b/client/src/wiegand_formats.c @@ -1676,17 +1676,18 @@ int HIDDumpPACSBits(const uint8_t *const data, const uint8_t length, bool verbos bytes_2_binstr(binstr, data + 1, n); - PrintAndLogEx(NORMAL, ""); - PrintAndLogEx(SUCCESS, "PACS......... " _GREEN_("%s"), sprint_hex_inrow(data, length)); - PrintAndLogEx(SUCCESS, "padded bin... " _GREEN_("%s") " ( %zu )", binstr, strlen(binstr)); +// PrintAndLogEx(NORMAL, ""); + PrintAndLogEx(INFO, "------------------------- " _CYAN_("Wiegand") " ---------------------------"); + PrintAndLogEx(SUCCESS, "PACS............. " _GREEN_("%s"), sprint_hex_inrow(data, length)); + PrintAndLogEx(DEBUG, "padded bin....... " _GREEN_("%s") " ( %zu )", binstr, strlen(binstr)); binstr[strlen(binstr) - pad] = '\0'; - PrintAndLogEx(SUCCESS, "bin.......... " _GREEN_("%s") " ( %zu )", binstr, strlen(binstr)); + PrintAndLogEx(DEBUG, "bin.............. " _GREEN_("%s") " ( %zu )", binstr, strlen(binstr)); size_t hexlen = 0; uint8_t hex[16] = {0}; binstr_2_bytes(hex, &hexlen, binstr); - PrintAndLogEx(SUCCESS, "hex.......... " _GREEN_("%s"), sprint_hex_inrow(hex, hexlen)); + PrintAndLogEx(SUCCESS, "hex.............. " _GREEN_("%s"), sprint_hex_inrow(hex, hexlen)); uint32_t top = 0, mid = 0, bot = 0; if (binstring_to_u96(&top, &mid, &bot, binstr) != strlen(binstr)) { @@ -1696,14 +1697,16 @@ int HIDDumpPACSBits(const uint8_t *const data, const uint8_t length, bool verbos } PrintAndLogEx(NORMAL, ""); - PrintAndLogEx(INFO, "Wiegand decode"); wiegand_message_t packed = initialize_message_object(top, mid, bot, strlen(binstr)); HIDTryUnpack(&packed); - PrintAndLogEx(NORMAL, ""); - if (strlen(binstr) >= 26 && verbose) { + + // SEOS + // iCLASS Legacy SE + // iCLASS Legacy SR + // iCLASS Legacy PrintAndLogEx(INFO, "Clone to " _YELLOW_("iCLASS Legacy")); PrintAndLogEx(SUCCESS, " hf iclass encode --ki 0 --bin %s", binstr); @@ -1714,6 +1717,8 @@ int HIDDumpPACSBits(const uint8_t *const data, const uint8_t length, bool verbos PrintAndLogEx(SUCCESS, " lf hid clone -w H10301 --bin %s", binstr); PrintAndLogEx(NORMAL, ""); + // MIFARE DESFire + // MIFARE Classic char mfcbin[28] = {0}; mfcbin[0] = '1'; diff --git a/client/src/wiegand_formatutils.c b/client/src/wiegand_formatutils.c index 9dfda9d0f..d6d5758e6 100644 --- a/client/src/wiegand_formatutils.c +++ b/client/src/wiegand_formatutils.c @@ -128,7 +128,7 @@ bool set_nonlinear_field(wiegand_message_t *data, uint64_t value, uint8_t numBit return result; } -static uint8_t get_length_from_header(wiegand_message_t *data) { +uint8_t get_length_from_header(wiegand_message_t *data) { /** * detect if message has "preamble" / "sentinel bit" * Right now we just calculate the highest bit set @@ -146,6 +146,7 @@ static uint8_t get_length_from_header(wiegand_message_t *data) { * 0000 0010 1xxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx 35-bit * 0000 0011 xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx 36-bit * 0000 000x xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx 37-bit + * 0000 00xx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx 38-bit */ uint8_t len = 0; uint32_t hfmt = 0; // for calculating card length @@ -188,13 +189,15 @@ wiegand_message_t initialize_message_object(uint32_t top, uint32_t mid, uint32_t bool add_HID_header(wiegand_message_t *data) { // Invalid value - if (data->Length > 84 || data->Length == 0) + if (data->Length > 84 || data->Length == 0) { return false; + } if (data->Length == 48) { data->Mid |= 1U << (data->Length - 32); // Example leading 1: start bit return true; } + if (data->Length >= 64) { data->Top |= 0x09e00000; // Extended-length header data->Top |= 1U << (data->Length - 64); // leading 1: start bit diff --git a/client/src/wiegand_formatutils.h b/client/src/wiegand_formatutils.h index 01a413032..05a36329b 100644 --- a/client/src/wiegand_formatutils.h +++ b/client/src/wiegand_formatutils.h @@ -52,6 +52,7 @@ bool set_nonlinear_field(wiegand_message_t *data, uint64_t value, uint8_t numBit wiegand_message_t initialize_message_object(uint32_t top, uint32_t mid, uint32_t bot, int n); +uint8_t get_length_from_header(wiegand_message_t *data); bool add_HID_header(wiegand_message_t *data); #endif diff --git a/doc/commands.json b/doc/commands.json index 530cad30a..812792b26 100644 --- a/doc/commands.json +++ b/doc/commands.json @@ -13167,8 +13167,8 @@ "command": "wiegand decode", "description": "Decode raw hex or binary to wiegand format", "notes": [ - "wiegand decode --raw 2006f623ae", - "wiegand decode --new 04801EEF8DC0 -> 4..8 bytes, new padded format" + "wiegand decode --raw 2006F623AE", + "wiegand decode --new 06BD88EB80 -> 4..8 bytes, new padded format" ], "offline": true, "options": [ @@ -13214,6 +13214,6 @@ "metadata": { "commands_extracted": 759, "extracted_by": "PM3Help2JSON v1.00", - "extracted_on": "2025-02-23T21:55:16" + "extracted_on": "2025-03-02T15:43:45" } }