diff --git a/client/src/cmdlfawid.c b/client/src/cmdlfawid.c index e3a0d78bc..51a0eea11 100644 --- a/client/src/cmdlfawid.c +++ b/client/src/cmdlfawid.c @@ -41,15 +41,17 @@ static int sendPing(void) { SendCommandNG(CMD_PING, NULL, 0); clearCommandBuffer(); PacketResponseNG resp; - if (!WaitForResponseTimeout(CMD_PING, &resp, 1000)) + if (WaitForResponseTimeout(CMD_PING, &resp, 1000) == false) { return PM3_ETIMEOUT; + } return PM3_SUCCESS; } static int sendTry(uint8_t fmtlen, uint32_t fc, uint32_t cn, uint32_t delay, uint8_t *bits, size_t bs_len, bool verbose) { - if (verbose) + if (verbose) { PrintAndLogEx(INFO, "Trying FC: " _YELLOW_("%u") " CN: " _YELLOW_("%u"), fc, cn); + } if (getAWIDBits(fmtlen, fc, cn, bits) != PM3_SUCCESS) { PrintAndLogEx(ERR, "Error with tag bitstream generation."); @@ -205,6 +207,11 @@ int demodAWID(bool verbose) { free(bits); return PM3_ESOFT; } + + char binstr[68] = {0}; + binarray_2_binstr(binstr, (char *)bits, size); + PrintAndLogEx(DEBUG, "no parity... %s", binstr); + // ok valid card found! // Index map @@ -230,35 +237,47 @@ int demodAWID(bool verbose) { uint8_t fmtLen = bytebits_to_byte(bits, 8); switch (fmtLen) { - case 26: + case 26: { fc = bytebits_to_byte(bits + 9, 8); cardnum = bytebits_to_byte(bits + 17, 16); code1 = bytebits_to_byte(bits + 8, fmtLen); PrintAndLogEx(SUCCESS, "AWID - len: " _GREEN_("%d") " FC: " _GREEN_("%d") " Card: " _GREEN_("%u") " - Wiegand: " _GREEN_("%x") ", Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, rawHi2, rawHi, rawLo); break; - case 34: + } + case 34: { fc = bytebits_to_byte(bits + 9, 8); cardnum = bytebits_to_byte(bits + 17, 24); code1 = bytebits_to_byte(bits + 8, (fmtLen - 32)); code2 = bytebits_to_byte(bits + 8 + (fmtLen - 32), 32); PrintAndLogEx(SUCCESS, "AWID - len: " _GREEN_("%d") " FC: " _GREEN_("%d") " Card: " _GREEN_("%u") " - Wiegand: " _GREEN_("%x%08x") ", Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, code2, rawHi2, rawHi, rawLo); break; - case 37: + } + case 36: { + fc = bytebits_to_byte(bits + 14, 11); + cardnum = bytebits_to_byte(bits + 25, 18); + code1 = bytebits_to_byte(bits + 8, (fmtLen - 32)); + code2 = bytebits_to_byte(bits + 8 + (fmtLen - 32), 32); + PrintAndLogEx(SUCCESS, "AWID - len: " _GREEN_("%d") " FC: " _GREEN_("%d") " Card: " _GREEN_("%u") " - Wiegand: " _GREEN_("%x%08x") ", Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, code2, rawHi2, rawHi, rawLo); + break; + } + case 37: { fc = bytebits_to_byte(bits + 9, 13); cardnum = bytebits_to_byte(bits + 22, 18); code1 = bytebits_to_byte(bits + 8, (fmtLen - 32)); code2 = bytebits_to_byte(bits + 8 + (fmtLen - 32), 32); PrintAndLogEx(SUCCESS, "AWID - len: " _GREEN_("%d")" FC: " _GREEN_("%d")" Card: " _GREEN_("%u") " - Wiegand: " _GREEN_("%x%08x") ", Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, code2, rawHi2, rawHi, rawLo); break; + } // case 40: // break; - case 50: + case 50: { fc = bytebits_to_byte(bits + 9, 16); cardnum = bytebits_to_byte(bits + 25, 32); code1 = bytebits_to_byte(bits + 8, (fmtLen - 32)); code2 = bytebits_to_byte(bits + 8 + (fmtLen - 32), 32); PrintAndLogEx(SUCCESS, "AWID - len: " _GREEN_("%d") " FC: " _GREEN_("%d") " Card: " _GREEN_("%u") " - Wiegand: " _GREEN_("%x%08x") ", Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, code2, rawHi2, rawHi, rawLo); break; + } default: if (fmtLen > 32) { cardnum = bytebits_to_byte(bits + 8 + (fmtLen - 17), 16); @@ -288,7 +307,9 @@ static int CmdAWIDDemod(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "lf awid demod", "Try to find AWID Prox preamble, if found decode / descramble data", - "lf awid demod" + "lf awid demod\n" + "lf awid demod --raw " + ); void *argtable[] = { @@ -566,9 +587,10 @@ static int CmdAWIDBrute(const char *Cmd) { static command_t CommandTable[] = { {"help", CmdHelp, AlwaysAvailable, "this help"}, + {"brute", CmdAWIDBrute, IfPm3Lf, "bruteforce card number against reader"}, + {"clone", CmdAWIDClone, IfPm3Lf, "clone AWID tag to T55x7, Q5/T5555 or EM4305/4469"}, {"demod", CmdAWIDDemod, AlwaysAvailable, "demodulate an AWID FSK tag from the GraphBuffer"}, {"reader", CmdAWIDReader, IfPm3Lf, "attempt to read and extract tag data"}, - {"clone", CmdAWIDClone, IfPm3Lf, "clone AWID tag to T55x7, Q5/T5555 or EM4305/4469"}, {"sim", CmdAWIDSim, IfPm3Lf, "simulate AWID tag"}, {"brute", CmdAWIDBrute, IfPm3Lf, "bruteforce card number against reader"}, {"watch", CmdAWIDWatch, IfPm3Lf, "continuously watch for cards. Reader mode"}, diff --git a/client/src/cmdlfem4x05.c b/client/src/cmdlfem4x05.c index bc6d731e6..b70eaf75a 100644 --- a/client/src/cmdlfem4x05.c +++ b/client/src/cmdlfem4x05.c @@ -1750,9 +1750,9 @@ int CmdEM4x05Chk(const char *Cmd) { res = loadFileDICTIONARY_safe(filename, (void **) &keyBlock, 4, &keycount); if (res != PM3_SUCCESS || keycount == 0 || keyBlock == NULL) { PrintAndLogEx(WARNING, "no keys found in file"); - if (keyBlock != NULL) + if (keyBlock != NULL) { free(keyBlock); - + } return PM3_ESOFT; } @@ -2634,7 +2634,7 @@ static command_t CommandTable[] = { {"-----------", CmdHelp, AlwaysAvailable, "----------------------- " _CYAN_("Operations") " -----------------------"}, {"clonehelp", CmdEM4x05CloneHelp, IfPm3Lf, "Shows the available clone commands"}, {"brute", CmdEM4x05Brute, IfPm3Lf, "Bruteforce password"}, - {"chk", CmdEM4x05Chk, IfPm3Lf, "Check passwords from dictionary"}, + {"chk", CmdEM4x05Chk, IfPm3Lf, "Check passwords"}, {"config", CmdEM4x05Config, AlwaysAvailable, "Create common configuration words"}, {"demod", CmdEM4x05Demod, AlwaysAvailable, "Demodulate a EM4x05/EM4x69 tag from the GraphBuffer"}, {"dump", CmdEM4x05Dump, IfPm3Lf, "Dump EM4x05/EM4x69 tag"},