mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-03-22 21:17:31 +08:00
fix hf iclass decrypt wiegand
This commit is contained in:
parent
c6386c68e0
commit
3bbcefacf9
2 changed files with 8 additions and 9 deletions
|
@ -1343,26 +1343,24 @@ static int CmdHFiClassDecrypt(const char *Cmd) {
|
||||||
if (has_values) {
|
if (has_values) {
|
||||||
|
|
||||||
//todo: remove preamble/sentinel
|
//todo: remove preamble/sentinel
|
||||||
uint32_t top = 0, mid, bot;
|
uint32_t top = 0, mid = 0, bot = 0;
|
||||||
mid = bytes_to_num(decrypted + (8 * 7), 4);
|
|
||||||
bot = bytes_to_num(decrypted + (8 * 7) + 4, 4);
|
|
||||||
|
|
||||||
PrintAndLogEx(INFO, "Block 7 decoder");
|
PrintAndLogEx(INFO, "Block 7 decoder");
|
||||||
|
|
||||||
char hexstr[16 + 1] = {0};
|
char hexstr[16 + 1] = {0};
|
||||||
hex_to_buffer((uint8_t *)hexstr, decrypted + (8 * 7), 8, sizeof(hexstr) - 1, 0, 0, true);
|
hex_to_buffer((uint8_t *)hexstr, decrypted + (8 * 7), 8, sizeof(hexstr) - 1, 0, 0, true);
|
||||||
|
hexstring_to_u96(&top, &mid, &bot, hexstr);
|
||||||
|
|
||||||
char binstr[8 * 8 + 1] = {0};
|
char binstr[64 + 1];
|
||||||
hextobinstring(binstr, hexstr);
|
hextobinstring(binstr, hexstr);
|
||||||
size_t i = 0;
|
char *pbin = binstr;
|
||||||
while (i < strlen(binstr) && binstr[i++] == '0');
|
while (strlen(pbin) && *(++pbin) == '0');
|
||||||
|
|
||||||
PrintAndLogEx(SUCCESS, "Binary..................... " _GREEN_("%s"), binstr + i);
|
PrintAndLogEx(SUCCESS, "Binary..................... " _GREEN_("%s"), pbin);
|
||||||
|
|
||||||
PrintAndLogEx(INFO, "Wiegand decode");
|
PrintAndLogEx(INFO, "Wiegand decode");
|
||||||
wiegand_message_t packed = initialize_message_object(top, mid, bot, strlen(binstr + i));
|
wiegand_message_t packed = initialize_message_object(top, mid, bot, 0);
|
||||||
HIDTryUnpack(&packed);
|
HIDTryUnpack(&packed);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
PrintAndLogEx(INFO, "No credential found");
|
PrintAndLogEx(INFO, "No credential found");
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,6 +158,7 @@ int CmdWiegandDecode(const char *Cmd) {
|
||||||
PrintAndLogEx(ERR, "empty input");
|
PrintAndLogEx(ERR, "empty input");
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
wiegand_message_t packed = initialize_message_object(top, mid, bot, blen);
|
wiegand_message_t packed = initialize_message_object(top, mid, bot, blen);
|
||||||
HIDTryUnpack(&packed);
|
HIDTryUnpack(&packed);
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
|
|
Loading…
Add table
Reference in a new issue