diff --git a/client/src/cmdhf.c b/client/src/cmdhf.c index c0ae5f3da..f80afa67e 100644 --- a/client/src/cmdhf.c +++ b/client/src/cmdhf.c @@ -82,11 +82,14 @@ int CmdHFSearch(const char *Cmd) { int res = PM3_ESOFT; + uint8_t success[20] = {0}; + PROMPT_CLEARLINE; PrintAndLogEx(INPLACE, " Searching for ThinFilm tag..."); if (IfPm3NfcBarcode()) { if (infoThinFilm(false) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Thinfilm tag") " found\n"); + success[THINFILM] = true; res = PM3_SUCCESS; } } @@ -96,6 +99,7 @@ int CmdHFSearch(const char *Cmd) { if (IfPm3Iso14443a()) { if (reader_lto(false, false) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("LTO-CM tag") " found\n"); + success[LTO] = true; res = PM3_SUCCESS; } } @@ -106,6 +110,7 @@ int CmdHFSearch(const char *Cmd) { int sel_state = infoHF14A(false, false, false); if (sel_state > 0) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("ISO 14443-A tag") " found\n"); + success[ISO_14443A] = true; res = PM3_SUCCESS; if (sel_state == 1) @@ -118,6 +123,7 @@ int CmdHFSearch(const char *Cmd) { if (IfPm3Legicrf()) { if (readLegicUid(false, false) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("LEGIC Prime tag") " found\n"); + success[LEGIC] = true; res = PM3_SUCCESS; } } @@ -127,6 +133,7 @@ int CmdHFSearch(const char *Cmd) { if (IfPm3Iso14443a()) { if (readTopazUid(false, false) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Topaz tag") " found\n"); + success[TOPAZ] = true; res = PM3_SUCCESS; } } @@ -136,6 +143,7 @@ int CmdHFSearch(const char *Cmd) { PrintAndLogEx(INPLACE, " Searching for TEXKOM tag..."); if (read_texkom_uid(false, false) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("TEXKOM tag") " found\n"); + success[PROTO_TEXKOM] = true; res = PM3_SUCCESS; } @@ -145,6 +153,7 @@ int CmdHFSearch(const char *Cmd) { if (IfPm3Iso14443b()) { if (read_xerox_uid(false, false) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Fuji/Xerox tag") " found\n"); + success[PROTO_XEROX] = true; res = PM3_SUCCESS; } } @@ -155,6 +164,7 @@ int CmdHFSearch(const char *Cmd) { if (IfPm3Iso14443b()) { if (readHF14B(false, false) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("ISO 14443-B tag") " found\n"); + success[ISO_14443B] = true; res = PM3_SUCCESS; } } @@ -166,6 +176,7 @@ int CmdHFSearch(const char *Cmd) { if (IfPm3Iso15693()) { if (readHF15Uid(false, false)) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("ISO 15693 tag") " found\n"); + success[ISO_15693] = true; res = PM3_SUCCESS; } } @@ -175,7 +186,7 @@ int CmdHFSearch(const char *Cmd) { if (IfPm3Iclass()) { if (read_iclass_csn(false, false, false) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("iCLASS tag / PicoPass tag") " found\n"); - PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`hf iclass`") " commands\n"); + success[ICLASS] = true; res = PM3_SUCCESS; } } @@ -187,6 +198,7 @@ int CmdHFSearch(const char *Cmd) { if (IfPm3Felica()) { if (read_felica_uid(false, false) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("ISO 18092 / FeliCa tag") " found\n"); + success[FELICA] = true; res = PM3_SUCCESS; } } @@ -197,6 +209,7 @@ int CmdHFSearch(const char *Cmd) { if (IfPm3Iso14443b()) { if (readHFCryptoRF(false, false) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("CryptoRF tag") " found\n"); + success[CRYPTORF] = true; res = PM3_SUCCESS; } } @@ -206,6 +219,53 @@ int CmdHFSearch(const char *Cmd) { if (res != PM3_SUCCESS) { PrintAndLogEx(WARNING, _RED_("No known/supported 13.56 MHz tags found")); res = PM3_ESOFT; + } else { + + // no need to print 14A hints, since it will print itself + + if (success[THINFILM]) { + PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`hf thinfilm`") " commands\n"); + } + + if (success[LTO]) { + PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`hf lto`") " commands\n"); + } + + if (success[LEGIC]) { + PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`hf legic`") " commands\n"); + } + + if (success[TOPAZ]) { + PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`hf topaz`") " commands\n"); + } + + if (success[PROTO_TEXKOM]) { + PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`hf texkom`") " commands\n"); + } + + if (success[PROTO_XEROX]) { + PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`hf xerox`") " commands\n"); + } + + if (success[ISO_14443B]) { + PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`hf 14b`") " commands\n"); + } + + if (success[ISO_15693]) { + PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`hf 15`") " commands\n"); + } + + if (success[ICLASS]) { + PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`hf iclass`") " commands\n"); + } + + if (success[FELICA]) { + PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`hf felica`") " commands\n"); + } + + if (success[PROTO_CRYPTORF]) { + PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`hf cryptorf`") " commands\n"); + } } DropField();