Use CmdTraceListAlias everywhere

This commit is contained in:
Philippe Teuwen 2021-04-19 21:43:32 +02:00
parent 2e925d5da3
commit dc54dd305b
18 changed files with 25 additions and 116 deletions

View file

@ -386,6 +386,10 @@ int CmdHFPlot(const char *Cmd) {
return handle_hf_plot(); return handle_hf_plot();
} }
static int CmdHFList(const char *Cmd) {
return CmdTraceListAlias(Cmd, "hf", "raw");
}
static command_t CommandTable[] = { static command_t CommandTable[] = {
{"--------", CmdHelp, AlwaysAvailable, "----------------------- " _CYAN_("High Frequency") " -----------------------"}, {"--------", CmdHelp, AlwaysAvailable, "----------------------- " _CYAN_("High Frequency") " -----------------------"},
@ -411,7 +415,7 @@ static command_t CommandTable[] = {
{"waveshare", CmdHFWaveshare, AlwaysAvailable, "{ Waveshare NFC ePaper... }"}, {"waveshare", CmdHFWaveshare, AlwaysAvailable, "{ Waveshare NFC ePaper... }"},
{"-----------", CmdHelp, AlwaysAvailable, "--------------------- " _CYAN_("General") " ---------------------"}, {"-----------", CmdHelp, AlwaysAvailable, "--------------------- " _CYAN_("General") " ---------------------"},
{"help", CmdHelp, AlwaysAvailable, "This help"}, {"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"}, {"plot", CmdHFPlot, IfPm3Hfplot, "Plot signal"},
{"tune", CmdHFTune, IfPm3Present, "Continuously measure HF antenna tuning"}, {"tune", CmdHFTune, IfPm3Present, "Continuously measure HF antenna tuning"},
{"search", CmdHFSearch, AlwaysAvailable, "Search for known HF tags"}, {"search", CmdHFSearch, AlwaysAvailable, "Search for known HF tags"},

View file

@ -199,13 +199,7 @@ static bool wait_cmd_14b(bool verbose, bool is_select) {
} }
static int CmdHF14BList(const char *Cmd) { static int CmdHF14BList(const char *Cmd) {
char args[128] = {0}; return CmdTraceListAlias(Cmd, "hf 14b", "14b");
if (strlen(Cmd) == 0) {
snprintf(args, sizeof(args), "-t 14b");
} else {
strncpy(args, Cmd, sizeof(args) - 1);
}
return CmdTraceList(args);
} }
static int CmdHF14BSim(const char *Cmd) { static int CmdHF14BSim(const char *Cmd) {

View file

@ -1434,13 +1434,7 @@ static int CmdHF15Dump(const char *Cmd) {
} }
static int CmdHF15List(const char *Cmd) { static int CmdHF15List(const char *Cmd) {
char args[128] = {0}; return CmdTraceListAlias(Cmd, "hf 15", "15");
if (strlen(Cmd) == 0) {
snprintf(args, sizeof(args), "-t 15");
} else {
strncpy(args, Cmd, sizeof(args) - 1);
}
return CmdTraceList(args);
} }
static int CmdHF15Raw(const char *Cmd) { static int CmdHF15Raw(const char *Cmd) {

View file

@ -42,13 +42,7 @@ static int switch_off_field_cryptorf(void) {
} }
static int CmdHFCryptoRFList(const char *Cmd) { static int CmdHFCryptoRFList(const char *Cmd) {
char args[128] = {0}; return CmdTraceListAlias(Cmd, "hf cryptorf", "cryptorf");
if (strlen(Cmd) == 0) {
snprintf(args, sizeof(args), "-t cryptorf");
} else {
strncpy(args, Cmd, sizeof(args) - 1);
}
return CmdTraceList(args);
} }
static int CmdHFCryptoRFSim(const char *Cmd) { static int CmdHFCryptoRFSim(const char *Cmd) {

View file

@ -2259,13 +2259,7 @@ static int cmd_hf_emrtd_info(const char *Cmd) {
} }
static int cmd_hf_emrtd_list(const char *Cmd) { static int cmd_hf_emrtd_list(const char *Cmd) {
char args[128] = {0}; return CmdTraceListAlias(Cmd, "hf emrtd", "7816");
if (strlen(Cmd) == 0) {
snprintf(args, sizeof(args), "-t 7816");
} else {
strncpy(args, Cmd, sizeof(args) - 1);
}
return CmdTraceList(args);
} }
static command_t CommandTable[] = { static command_t CommandTable[] = {

View file

@ -214,13 +214,7 @@ static bool add_last_IDm(uint8_t position, uint8_t *data) {
} }
static int CmdHFFelicaList(const char *Cmd) { static int CmdHFFelicaList(const char *Cmd) {
char args[128] = {0}; return CmdTraceListAlias(Cmd, "hf felica", "felica");
if (strlen(Cmd) == 0) {
snprintf(args, sizeof(args), "-t felica");
} else {
strncpy(args, Cmd, sizeof(args) - 1);
}
return CmdTraceList(args);
} }
int read_felica_uid(bool loop, bool verbose) { int read_felica_uid(bool loop, bool verbose) {

View file

@ -39,13 +39,7 @@
static int CmdHelp(const char *Cmd); static int CmdHelp(const char *Cmd);
static int cmd_hf_fido_list(const char *Cmd) { static int cmd_hf_fido_list(const char *Cmd) {
char args[128] = {0}; return CmdTraceListAlias(Cmd, "hf fido", "14a");
if (strlen(Cmd) == 0) {
snprintf(args, sizeof(args), "-t 14a");
} else {
strncpy(args, Cmd, sizeof(args) - 1);
}
return CmdTraceList(args);
} }
static int cmd_hf_fido_info(const char *Cmd) { 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[] = { static command_t CommandTable[] = {
{"help", CmdHelp, AlwaysAvailable, "This help."}, {"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."}, {"info", cmd_hf_fido_info, IfPm3Iso14443a, "Info about FIDO tag."},
{"reg", cmd_hf_fido_register, IfPm3Iso14443a, "FIDO U2F Registration Message."}, {"reg", cmd_hf_fido_register, IfPm3Iso14443a, "FIDO U2F Registration Message."},
{"auth", cmd_hf_fido_authenticate, IfPm3Iso14443a, "FIDO U2F Authentication Message."}, {"auth", cmd_hf_fido_authenticate, IfPm3Iso14443a, "FIDO U2F Authentication Message."},

View file

@ -535,13 +535,7 @@ static void print_picopass_header(const picopass_hdr_t *hdr) {
} }
static int CmdHFiClassList(const char *Cmd) { static int CmdHFiClassList(const char *Cmd) {
char args[128] = {0}; return CmdTraceListAlias(Cmd, "hf iclass", "iclass");
if (strlen(Cmd) == 0) {
snprintf(args, sizeof(args), "-t iclass");
} else {
strncpy(args, Cmd, sizeof(args) - 1);
}
return CmdTraceList(args);
} }
static int CmdHFiClassSniff(const char *Cmd) { static int CmdHFiClassSniff(const char *Cmd) {

View file

@ -1164,13 +1164,7 @@ static int CmdLegicWipe(const char *Cmd) {
} }
static int CmdLegicList(const char *Cmd) { static int CmdLegicList(const char *Cmd) {
char args[128] = {0}; return CmdTraceListAlias(Cmd, "hf legic", "legic");
if (strlen(Cmd) == 0) {
snprintf(args, sizeof(args), "-t legic");
} else {
strncpy(args, Cmd, sizeof(args) - 1);
}
return CmdTraceList(args);
} }
static command_t CommandTable[] = { static command_t CommandTable[] = {

View file

@ -172,13 +172,7 @@ int infoLTO(bool verbose) {
} }
static int CmdHfLTOList(const char *Cmd) { static int CmdHfLTOList(const char *Cmd) {
char args[128] = {0}; return CmdTraceListAlias(Cmd, "hf lto", "lto");
if (strlen(Cmd) == 0) {
snprintf(args, sizeof(args), "-t lto");
} else {
strncpy(args, Cmd, sizeof(args) - 1);
}
return CmdTraceList(args);
} }
static int lto_rdbl(uint8_t blk, uint8_t *block_response, uint8_t *block_cnt_response, bool verbose) { static int lto_rdbl(uint8_t blk, uint8_t *block_response, uint8_t *block_cnt_response, bool verbose) {

View file

@ -5529,13 +5529,7 @@ static int CmdHFMFPersonalize(const char *cmd) {
} }
static int CmdHF14AMfList(const char *Cmd) { static int CmdHF14AMfList(const char *Cmd) {
char args[128] = {0}; return CmdTraceListAlias(Cmd, "hf mf", "mf");
if (strlen(Cmd) == 0) {
snprintf(args, sizeof(args), "-t mf");
} else {
strncpy(args, Cmd, sizeof(args) - 1);
}
return CmdTraceList(args);
} }
static int CmdHf14AGen3UID(const char *Cmd) { static int CmdHf14AGen3UID(const char *Cmd) {

View file

@ -4803,13 +4803,7 @@ static int CmdHF14aDesChk(const char *Cmd) {
} }
static int CmdHF14ADesList(const char *Cmd) { static int CmdHF14ADesList(const char *Cmd) {
char args[128] = {0}; return CmdTraceListAlias(Cmd, "hf mfdes", "des");
if (strlen(Cmd) == 0) {
snprintf(args, sizeof(args), "-t des");
} else {
strncpy(args, Cmd, sizeof(args) - 1);
}
return CmdTraceList(args);
} }
/* /*

View file

@ -788,6 +788,7 @@ static int cmd_hf_st_pwd(const char *Cmd) {
} }
static int cmd_hf_st_list(const char *Cmd) { static int cmd_hf_st_list(const char *Cmd) {
return CmdTraceListAlias(Cmd, "hf st", "7816");
char args[128] = {0}; char args[128] = {0};
if (strlen(Cmd) == 0) { if (strlen(Cmd) == 0) {
snprintf(args, sizeof(args), "-t 7816"); snprintf(args, sizeof(args), "-t 7816");

View file

@ -191,13 +191,7 @@ static int CmdHfThinFilmSim(const char *Cmd) {
} }
static int CmdHfThinFilmList(const char *Cmd) { static int CmdHfThinFilmList(const char *Cmd) {
char args[128] = {0}; return CmdTraceListAlias(Cmd, "hf thinfilm", "thinfilm");
if (strlen(Cmd) == 0) {
snprintf(args, sizeof(args), "-t thinfilm");
} else {
strncpy(args, Cmd, sizeof(args) - 1);
}
return CmdTraceList(args);
} }
static command_t CommandTable[] = { static command_t CommandTable[] = {

View file

@ -524,13 +524,7 @@ static int CmdHFTopazCmdRaw(const char *Cmd) {
} }
static int CmdHFTopazList(const char *Cmd) { static int CmdHFTopazList(const char *Cmd) {
char args[128] = {0}; return CmdTraceListAlias(Cmd, "hf topaz", "topaz");
if (strlen(Cmd) == 0) {
snprintf(args, sizeof(args), "-t topaz");
} else {
strncpy(args, Cmd, sizeof(args) - 1);
}
return CmdTraceList(args);
} }
static int CmdHFTopazSniff(const char *Cmd) { static int CmdHFTopazSniff(const char *Cmd) {

View file

@ -52,13 +52,7 @@ static size_t nbytes(size_t nbits) {
*/ */
static int CmdLFHitagList(const char *Cmd) { static int CmdLFHitagList(const char *Cmd) {
char args[128] = {0}; return CmdTraceListAlias(Cmd, "lf hitag", "hitag2");
if (strlen(Cmd) == 0) {
snprintf(args, sizeof(args), "-t hitag2");
} else {
strncpy(args, Cmd, sizeof(args) - 1);
}
return CmdTraceList(args);
/* /*
@ -940,7 +934,7 @@ void annotateHitagS(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool
static command_t CommandTable[] = { static command_t CommandTable[] = {
{"help", CmdHelp, AlwaysAvailable, "This help"}, {"help", CmdHelp, AlwaysAvailable, "This help"},
{"eload", CmdLFHitagEload, IfPm3Hitag, "Load Hitag dump file into emulator memory"}, {"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"}, {"info", CmdLFHitagInfo, IfPm3Hitag, "Tag information"},
{"reader", CmdLFHitagReader, IfPm3Hitag, "Act like a Hitag reader"}, {"reader", CmdLFHitagReader, IfPm3Hitag, "Act like a Hitag reader"},
{"sim", CmdLFHitagSim, IfPm3Hitag, "Simulate Hitag transponder"}, {"sim", CmdLFHitagSim, IfPm3Hitag, "Simulate Hitag transponder"},

View file

@ -826,13 +826,7 @@ static int CmdSmartSetClock(const char *Cmd) {
} }
static int CmdSmartList(const char *Cmd) { static int CmdSmartList(const char *Cmd) {
char args[128] = {0}; return CmdTraceListAlias(Cmd, "smart", "7816");
if (strlen(Cmd) == 0) {
snprintf(args, sizeof(args), "-t 7816");
} else {
strncpy(args, Cmd, sizeof(args) - 1);
}
return CmdTraceList(args);
} }
static void smart_brute_prim(void) { static void smart_brute_prim(void) {
@ -1104,7 +1098,7 @@ static int CmdSmartBruteforceSFI(const char *Cmd) {
static command_t CommandTable[] = { static command_t CommandTable[] = {
{"help", CmdHelp, AlwaysAvailable, "This help"}, {"help", CmdHelp, AlwaysAvailable, "This help"},
{"list", CmdSmartList, IfPm3Smartcard, "List ISO 7816 history"}, {"list", CmdSmartList, AlwaysAvailable, "List ISO 7816 history"},
{"info", CmdSmartInfo, IfPm3Smartcard, "Tag information"}, {"info", CmdSmartInfo, IfPm3Smartcard, "Tag information"},
{"reader", CmdSmartReader, IfPm3Smartcard, "Act like an IS07816 reader"}, {"reader", CmdSmartReader, IfPm3Smartcard, "Act like an IS07816 reader"},
{"raw", CmdSmartRaw, IfPm3Smartcard, "Send raw hex data to tag"}, {"raw", CmdSmartRaw, IfPm3Smartcard, "Send raw hex data to tag"},

View file

@ -1803,13 +1803,7 @@ static int CmdEMVScan(const char *Cmd) {
} }
static int CmdEMVList(const char *Cmd) { static int CmdEMVList(const char *Cmd) {
char args[128] = {0}; return CmdTraceListAlias(Cmd, "emv", "7816");
if (strlen(Cmd) == 0) {
snprintf(args, sizeof(args), "-t 7816");
} else {
strncpy(args, Cmd, sizeof(args) - 1);
}
return CmdTraceList(args);
} }
static int CmdEMVTest(const char *Cmd) { static int CmdEMVTest(const char *Cmd) {