diff --git a/CHANGELOG.md b/CHANGELOG.md index 4153d5358..25c0fc715 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] +- Changed `hf mfu pwdgen` - reads the tag by default (`-r` removed), `--uid` is offline, new `--mfg` for the Philips toothbrush algo offline (@iceman1001) - Changed PM5 FPGA image - `client/resources/fpga_pm5.bin` is now built from the repo sources (`make -C fpga fpga_pm5_release`) and replaces the vendor built `PM5_FPGA_fix_loedge_bug.bin` (@iceman1001) - Changed `hf mf info`, `hf mfu info`, `hf mfdes info`, `hf felica info`, `hf 14b info`, `hf calypso info` and `hf 14a info` - identify transit cards by keys, AIDs, system codes or data, show card number / balance where free to read and hint at the full decode (@iceman1001) - Fixed PM5 `hf mf sim` and other 14a sims - the RSSI ADC was reset and recalibrated before every listen, missing fast reader frames such as the auth nR/aR (@iceman1001) diff --git a/client/src/cmdhfmfu.c b/client/src/cmdhfmfu.c index 0fa29c5ad..06400f154 100644 --- a/client/src/cmdhfmfu.c +++ b/client/src/cmdhfmfu.c @@ -1944,13 +1944,13 @@ static mfu_identify_t mfu_ident_table[] = { "Philips Toothbrush", "0004040201010F03", 16, 20, "0310D1010C55027068696C6970732E636F6DFE00", ul_ev1_pwdgen_def, ul_ev1_packgen_def, - "hf mfu pwdgen -r" + "hf mfu pwdgen" }, { "Philips Toothbrush", "0004040201010F03", 16, 36, "0320D1011C55027068696C6970732E636F6D2F6E6663627275736868656164746170FE00", ul_ev1_pwdgen_def, ul_ev1_packgen_def, - "hf mfu pwdgen -r" + "hf mfu pwdgen" }, { "Bank Of Archie brothers", "0004030101000B03", @@ -3052,11 +3052,11 @@ static int CmdHF14AMfUInfo(const char *Cmd) { } if (len < 1) { PrintAndLogEx(WARNING, _YELLOW_("password not known")); - PrintAndLogEx(HINT, "Hint: Try " _YELLOW_("`hf mfu pwdgen -r`") " to get see known pwd gen algo suggestions"); + PrintAndLogEx(HINT, "Hint: Try " _YELLOW_("`hf mfu pwdgen`") " to get see known pwd gen algo suggestions"); } } else { if (locked) { - PrintAndLogEx(HINT, "Hint: Try " _YELLOW_("`hf mfu pwdgen -r`") " to get see known pwd gen algo suggestions"); + PrintAndLogEx(HINT, "Hint: Try " _YELLOW_("`hf mfu pwdgen`") " to get see known pwd gen algo suggestions"); } } } @@ -3068,7 +3068,7 @@ out: if (locked) { PrintAndLogEx(INFO, "\nTag appears to be locked, try using a key to get more info"); - PrintAndLogEx(HINT, "Hint: Try " _YELLOW_("`hf mfu pwdgen -r`") " to get see known pwd gen algo suggestions"); + PrintAndLogEx(HINT, "Hint: Try " _YELLOW_("`hf mfu pwdgen`") " to get see known pwd gen algo suggestions"); } if (tagtype & (MFU_TT_MAGIC_1A | MFU_TT_MAGIC_1B | MFU_TT_MAGIC_2)) { @@ -6323,16 +6323,18 @@ static int CmdHF14AMfUKeyGen(const char *Cmd) { static int CmdHF14AMfUPwdGen(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf mfu pwdgen", - "Generate different passwords from known pwdgen algos", - "hf mfu pwdgen -r\n" - "hf mfu pwdgen --uid 11223344556677\n" + "Generate different passwords from known pwdgen algos.\n" + "Reads UID and Philips MFG string from the tag, or works offline with `--uid`.", + "hf mfu pwdgen -> read from tag\n" + "hf mfu pwdgen --uid 11223344556677 -> offline\n" + "hf mfu pwdgen --uid 040D4B5AC57181 --mfg 3231303632382035324D -> offline, Philips pwd FBCFACC1\n" "hf mfu pwdgen --test" ); void *argtable[] = { arg_param_begin, - arg_str0("u", "uid", "", "UID (7 hex bytes)"), - arg_lit0("r", NULL, "Read UID from tag"), + arg_str0("u", "uid", "", "UID (7 hex bytes), offline"), + arg_str0(NULL, "mfg", "", "Philips toothbrush MFG string, pages 21-23 bytes 2..11 (10 hex bytes)"), arg_lit0(NULL, "test", "self test"), arg_param_end }; @@ -6341,7 +6343,9 @@ static int CmdHF14AMfUPwdGen(const char *Cmd) { int u_len = 0; uint8_t uid[7] = {0x00}; CLIGetHexWithReturn(ctx, 1, uid, &u_len); - bool use_tag = arg_get_lit(ctx, 2); + int mfg_len = 0; + uint8_t philips_mfg[10] = {0}; + CLIGetHexWithReturn(ctx, 2, philips_mfg, &mfg_len); bool selftest = arg_get_lit(ctx, 3); CLIParserFree(ctx); @@ -6349,9 +6353,23 @@ static int CmdHF14AMfUPwdGen(const char *Cmd) { return generator_selftest(); } - uint8_t philips_mfg[10] = {0}; + if (mfg_len && mfg_len != sizeof(philips_mfg)) { + PrintAndLogEx(WARNING, "MFG must be 10 hex bytes"); + return PM3_EINVARG; + } + + if (mfg_len && u_len == 0) { + PrintAndLogEx(WARNING, "`--mfg` needs `--uid`"); + return PM3_EINVARG; + } + + if (u_len == 0) { + + if (g_session.pm3_present == false) { + PrintAndLogEx(WARNING, "Offline, use `--uid`"); + return PM3_ENOTTY; + } - if (use_tag) { // read uid from tag int res = ul_read_uid(uid); if (res == PM3_ELENGTH) { diff --git a/tools/pm3_tests.sh b/tools/pm3_tests.sh index 4ad21e5d5..f785c994b 100755 --- a/tools/pm3_tests.sh +++ b/tools/pm3_tests.sh @@ -475,6 +475,7 @@ while true; do if ! CheckExecute "data rawdemod ar samples" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_keri.pm3; data setdebugmode -1; data rawdemod --ar --samples 1000' 2>&1" "maxLen 1000"; then break; fi if ! CheckExecute "data rawdemod am max errors" "$CLIENTBIN -c 'data load -f traces/lf_EM4102-1.pm3; data setdebugmode -1; data rawdemod --am --max 300' 2>&1" "maxErr 300"; then break; fi if ! CheckExecute "mfu pwdgen test" "$CLIENTBIN -c 'hf mfu pwdgen --test'" "Selftest ok"; then break; fi + if ! CheckExecute "mfu pwdgen philips" "$CLIENTBIN -c 'hf mfu pwdgen --uid 040D4B5AC57181 --mfg 3231303632382035324D'" "Philips Toothbrush \\| FBCFACC1"; then break; fi if ! CheckExecute "mfu keygen test" "$CLIENTBIN -c 'hf mfu keygen --uid 11223344556677'" "80 B1 C2 71 D8 A0"; then break; fi if ! CheckExecute "jooki encode test" "$CLIENTBIN -c 'hf jooki encode --test'" "04 28 F4 DA F0 4A 81 \( ok \)"; then break; fi if ! CheckExecute "vigik signature selftest" "$CLIENTBIN -c 'hf mf view --selftest'" "selftest \\( ok \\)"; then break; fi