diff --git a/client/src/cmdhf.c b/client/src/cmdhf.c index a4c5b2544..f5ef9f188 100644 --- a/client/src/cmdhf.c +++ b/client/src/cmdhf.c @@ -386,6 +386,10 @@ int CmdHFPlot(const char *Cmd) { return handle_hf_plot(); } +static int CmdHFList(const char *Cmd) { + return CmdTraceListAlias(Cmd, "hf", "raw"); +} + static command_t CommandTable[] = { {"--------", CmdHelp, AlwaysAvailable, "----------------------- " _CYAN_("High Frequency") " -----------------------"}, @@ -411,7 +415,7 @@ static command_t CommandTable[] = { {"waveshare", CmdHFWaveshare, AlwaysAvailable, "{ Waveshare NFC ePaper... }"}, {"-----------", CmdHelp, AlwaysAvailable, "--------------------- " _CYAN_("General") " ---------------------"}, {"help", CmdHelp, AlwaysAvailable, "This help"}, - {"list", CmdTraceList, AlwaysAvailable, "List protocol data in trace buffer"}, + {"list", CmdHFList, AlwaysAvailable, "List protocol data in trace buffer"}, {"plot", CmdHFPlot, IfPm3Hfplot, "Plot signal"}, {"tune", CmdHFTune, IfPm3Present, "Continuously measure HF antenna tuning"}, {"search", CmdHFSearch, AlwaysAvailable, "Search for known HF tags"}, diff --git a/client/src/cmdhf14b.c b/client/src/cmdhf14b.c index 6ad2f90e3..959dfb489 100644 --- a/client/src/cmdhf14b.c +++ b/client/src/cmdhf14b.c @@ -199,13 +199,7 @@ static bool wait_cmd_14b(bool verbose, bool is_select) { } static int CmdHF14BList(const char *Cmd) { - char args[128] = {0}; - if (strlen(Cmd) == 0) { - snprintf(args, sizeof(args), "-t 14b"); - } else { - strncpy(args, Cmd, sizeof(args) - 1); - } - return CmdTraceList(args); + return CmdTraceListAlias(Cmd, "hf 14b", "14b"); } static int CmdHF14BSim(const char *Cmd) { diff --git a/client/src/cmdhf15.c b/client/src/cmdhf15.c index ea9ced998..30d2db275 100644 --- a/client/src/cmdhf15.c +++ b/client/src/cmdhf15.c @@ -1434,13 +1434,7 @@ static int CmdHF15Dump(const char *Cmd) { } static int CmdHF15List(const char *Cmd) { - char args[128] = {0}; - if (strlen(Cmd) == 0) { - snprintf(args, sizeof(args), "-t 15"); - } else { - strncpy(args, Cmd, sizeof(args) - 1); - } - return CmdTraceList(args); + return CmdTraceListAlias(Cmd, "hf 15", "15"); } static int CmdHF15Raw(const char *Cmd) { diff --git a/client/src/cmdhfcryptorf.c b/client/src/cmdhfcryptorf.c index 3640b9639..4b1155870 100644 --- a/client/src/cmdhfcryptorf.c +++ b/client/src/cmdhfcryptorf.c @@ -42,13 +42,7 @@ static int switch_off_field_cryptorf(void) { } static int CmdHFCryptoRFList(const char *Cmd) { - char args[128] = {0}; - if (strlen(Cmd) == 0) { - snprintf(args, sizeof(args), "-t cryptorf"); - } else { - strncpy(args, Cmd, sizeof(args) - 1); - } - return CmdTraceList(args); + return CmdTraceListAlias(Cmd, "hf cryptorf", "cryptorf"); } static int CmdHFCryptoRFSim(const char *Cmd) { diff --git a/client/src/cmdhfemrtd.c b/client/src/cmdhfemrtd.c index caa24b4ac..a61a8e709 100644 --- a/client/src/cmdhfemrtd.c +++ b/client/src/cmdhfemrtd.c @@ -2259,13 +2259,7 @@ static int cmd_hf_emrtd_info(const char *Cmd) { } static int cmd_hf_emrtd_list(const char *Cmd) { - char args[128] = {0}; - if (strlen(Cmd) == 0) { - snprintf(args, sizeof(args), "-t 7816"); - } else { - strncpy(args, Cmd, sizeof(args) - 1); - } - return CmdTraceList(args); + return CmdTraceListAlias(Cmd, "hf emrtd", "7816"); } static command_t CommandTable[] = { diff --git a/client/src/cmdhffelica.c b/client/src/cmdhffelica.c index 7e71fa175..04ddd94c9 100644 --- a/client/src/cmdhffelica.c +++ b/client/src/cmdhffelica.c @@ -214,13 +214,7 @@ static bool add_last_IDm(uint8_t position, uint8_t *data) { } static int CmdHFFelicaList(const char *Cmd) { - char args[128] = {0}; - if (strlen(Cmd) == 0) { - snprintf(args, sizeof(args), "-t felica"); - } else { - strncpy(args, Cmd, sizeof(args) - 1); - } - return CmdTraceList(args); + return CmdTraceListAlias(Cmd, "hf felica", "felica"); } int read_felica_uid(bool loop, bool verbose) { diff --git a/client/src/cmdhffido.c b/client/src/cmdhffido.c index 9fe85a4c8..4a0267fe5 100644 --- a/client/src/cmdhffido.c +++ b/client/src/cmdhffido.c @@ -39,13 +39,7 @@ static int CmdHelp(const char *Cmd); static int cmd_hf_fido_list(const char *Cmd) { - char args[128] = {0}; - if (strlen(Cmd) == 0) { - snprintf(args, sizeof(args), "-t 14a"); - } else { - strncpy(args, Cmd, sizeof(args) - 1); - } - return CmdTraceList(args); + return CmdTraceListAlias(Cmd, "hf fido", "14a"); } static int cmd_hf_fido_info(const char *Cmd) { @@ -941,7 +935,7 @@ static int cmd_hf_fido_2get_assertion(const char *cmd) { static command_t CommandTable[] = { {"help", CmdHelp, AlwaysAvailable, "This help."}, - {"list", cmd_hf_fido_list, IfPm3Iso14443a, "List ISO 14443A history"}, + {"list", cmd_hf_fido_list, AlwaysAvailable, "List ISO 14443A history"}, {"info", cmd_hf_fido_info, IfPm3Iso14443a, "Info about FIDO tag."}, {"reg", cmd_hf_fido_register, IfPm3Iso14443a, "FIDO U2F Registration Message."}, {"auth", cmd_hf_fido_authenticate, IfPm3Iso14443a, "FIDO U2F Authentication Message."}, diff --git a/client/src/cmdhficlass.c b/client/src/cmdhficlass.c index d6888cf80..2db1a8072 100644 --- a/client/src/cmdhficlass.c +++ b/client/src/cmdhficlass.c @@ -535,13 +535,7 @@ static void print_picopass_header(const picopass_hdr_t *hdr) { } static int CmdHFiClassList(const char *Cmd) { - char args[128] = {0}; - if (strlen(Cmd) == 0) { - snprintf(args, sizeof(args), "-t iclass"); - } else { - strncpy(args, Cmd, sizeof(args) - 1); - } - return CmdTraceList(args); + return CmdTraceListAlias(Cmd, "hf iclass", "iclass"); } static int CmdHFiClassSniff(const char *Cmd) { diff --git a/client/src/cmdhflegic.c b/client/src/cmdhflegic.c index 083945609..8bab7c120 100644 --- a/client/src/cmdhflegic.c +++ b/client/src/cmdhflegic.c @@ -1164,13 +1164,7 @@ static int CmdLegicWipe(const char *Cmd) { } static int CmdLegicList(const char *Cmd) { - char args[128] = {0}; - if (strlen(Cmd) == 0) { - snprintf(args, sizeof(args), "-t legic"); - } else { - strncpy(args, Cmd, sizeof(args) - 1); - } - return CmdTraceList(args); + return CmdTraceListAlias(Cmd, "hf legic", "legic"); } static command_t CommandTable[] = { diff --git a/client/src/cmdhflto.c b/client/src/cmdhflto.c index 828a69993..15ddd253f 100644 --- a/client/src/cmdhflto.c +++ b/client/src/cmdhflto.c @@ -172,13 +172,7 @@ int infoLTO(bool verbose) { } static int CmdHfLTOList(const char *Cmd) { - char args[128] = {0}; - if (strlen(Cmd) == 0) { - snprintf(args, sizeof(args), "-t lto"); - } else { - strncpy(args, Cmd, sizeof(args) - 1); - } - return CmdTraceList(args); + return CmdTraceListAlias(Cmd, "hf lto", "lto"); } static int lto_rdbl(uint8_t blk, uint8_t *block_response, uint8_t *block_cnt_response, bool verbose) { diff --git a/client/src/cmdhfmf.c b/client/src/cmdhfmf.c index 7ca124d45..b7e12d0af 100644 --- a/client/src/cmdhfmf.c +++ b/client/src/cmdhfmf.c @@ -5529,13 +5529,7 @@ static int CmdHFMFPersonalize(const char *cmd) { } static int CmdHF14AMfList(const char *Cmd) { - char args[128] = {0}; - if (strlen(Cmd) == 0) { - snprintf(args, sizeof(args), "-t mf"); - } else { - strncpy(args, Cmd, sizeof(args) - 1); - } - return CmdTraceList(args); + return CmdTraceListAlias(Cmd, "hf mf", "mf"); } static int CmdHf14AGen3UID(const char *Cmd) { diff --git a/client/src/cmdhfmfdes.c b/client/src/cmdhfmfdes.c index 3be04b5e3..f1673cfb5 100644 --- a/client/src/cmdhfmfdes.c +++ b/client/src/cmdhfmfdes.c @@ -4803,13 +4803,7 @@ static int CmdHF14aDesChk(const char *Cmd) { } static int CmdHF14ADesList(const char *Cmd) { - char args[128] = {0}; - if (strlen(Cmd) == 0) { - snprintf(args, sizeof(args), "-t des"); - } else { - strncpy(args, Cmd, sizeof(args) - 1); - } - return CmdTraceList(args); + return CmdTraceListAlias(Cmd, "hf mfdes", "des"); } /* diff --git a/client/src/cmdhfst.c b/client/src/cmdhfst.c index f53ace548..64e244323 100644 --- a/client/src/cmdhfst.c +++ b/client/src/cmdhfst.c @@ -788,6 +788,7 @@ static int cmd_hf_st_pwd(const char *Cmd) { } static int cmd_hf_st_list(const char *Cmd) { + return CmdTraceListAlias(Cmd, "hf st", "7816"); char args[128] = {0}; if (strlen(Cmd) == 0) { snprintf(args, sizeof(args), "-t 7816"); diff --git a/client/src/cmdhfthinfilm.c b/client/src/cmdhfthinfilm.c index 976e1314d..20fe64d84 100644 --- a/client/src/cmdhfthinfilm.c +++ b/client/src/cmdhfthinfilm.c @@ -191,13 +191,7 @@ static int CmdHfThinFilmSim(const char *Cmd) { } static int CmdHfThinFilmList(const char *Cmd) { - char args[128] = {0}; - if (strlen(Cmd) == 0) { - snprintf(args, sizeof(args), "-t thinfilm"); - } else { - strncpy(args, Cmd, sizeof(args) - 1); - } - return CmdTraceList(args); + return CmdTraceListAlias(Cmd, "hf thinfilm", "thinfilm"); } static command_t CommandTable[] = { diff --git a/client/src/cmdhftopaz.c b/client/src/cmdhftopaz.c index a6564ae17..69f840b19 100644 --- a/client/src/cmdhftopaz.c +++ b/client/src/cmdhftopaz.c @@ -524,13 +524,7 @@ static int CmdHFTopazCmdRaw(const char *Cmd) { } static int CmdHFTopazList(const char *Cmd) { - char args[128] = {0}; - if (strlen(Cmd) == 0) { - snprintf(args, sizeof(args), "-t topaz"); - } else { - strncpy(args, Cmd, sizeof(args) - 1); - } - return CmdTraceList(args); + return CmdTraceListAlias(Cmd, "hf topaz", "topaz"); } static int CmdHFTopazSniff(const char *Cmd) { diff --git a/client/src/cmdlfhitag.c b/client/src/cmdlfhitag.c index 509e5218b..96daa6390 100644 --- a/client/src/cmdlfhitag.c +++ b/client/src/cmdlfhitag.c @@ -52,13 +52,7 @@ static size_t nbytes(size_t nbits) { */ static int CmdLFHitagList(const char *Cmd) { - char args[128] = {0}; - if (strlen(Cmd) == 0) { - snprintf(args, sizeof(args), "-t hitag2"); - } else { - strncpy(args, Cmd, sizeof(args) - 1); - } - return CmdTraceList(args); + return CmdTraceListAlias(Cmd, "lf hitag", "hitag2"); /* @@ -940,7 +934,7 @@ void annotateHitagS(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool static command_t CommandTable[] = { {"help", CmdHelp, AlwaysAvailable, "This help"}, {"eload", CmdLFHitagEload, IfPm3Hitag, "Load Hitag dump file into emulator memory"}, - {"list", CmdLFHitagList, IfPm3Hitag, "List Hitag trace history"}, + {"list", CmdLFHitagList, AlwaysAvailable, "List Hitag trace history"}, {"info", CmdLFHitagInfo, IfPm3Hitag, "Tag information"}, {"reader", CmdLFHitagReader, IfPm3Hitag, "Act like a Hitag reader"}, {"sim", CmdLFHitagSim, IfPm3Hitag, "Simulate Hitag transponder"}, diff --git a/client/src/cmdsmartcard.c b/client/src/cmdsmartcard.c index 7c2e615d7..fcd52abf8 100644 --- a/client/src/cmdsmartcard.c +++ b/client/src/cmdsmartcard.c @@ -826,13 +826,7 @@ static int CmdSmartSetClock(const char *Cmd) { } static int CmdSmartList(const char *Cmd) { - char args[128] = {0}; - if (strlen(Cmd) == 0) { - snprintf(args, sizeof(args), "-t 7816"); - } else { - strncpy(args, Cmd, sizeof(args) - 1); - } - return CmdTraceList(args); + return CmdTraceListAlias(Cmd, "smart", "7816"); } static void smart_brute_prim(void) { @@ -1104,7 +1098,7 @@ static int CmdSmartBruteforceSFI(const char *Cmd) { static command_t CommandTable[] = { {"help", CmdHelp, AlwaysAvailable, "This help"}, - {"list", CmdSmartList, IfPm3Smartcard, "List ISO 7816 history"}, + {"list", CmdSmartList, AlwaysAvailable, "List ISO 7816 history"}, {"info", CmdSmartInfo, IfPm3Smartcard, "Tag information"}, {"reader", CmdSmartReader, IfPm3Smartcard, "Act like an IS07816 reader"}, {"raw", CmdSmartRaw, IfPm3Smartcard, "Send raw hex data to tag"}, diff --git a/client/src/emv/cmdemv.c b/client/src/emv/cmdemv.c index 718fb6bcd..989acaf6c 100644 --- a/client/src/emv/cmdemv.c +++ b/client/src/emv/cmdemv.c @@ -1803,13 +1803,7 @@ static int CmdEMVScan(const char *Cmd) { } static int CmdEMVList(const char *Cmd) { - char args[128] = {0}; - if (strlen(Cmd) == 0) { - snprintf(args, sizeof(args), "-t 7816"); - } else { - strncpy(args, Cmd, sizeof(args) - 1); - } - return CmdTraceList(args); + return CmdTraceListAlias(Cmd, "emv", "7816"); } static int CmdEMVTest(const char *Cmd) {