mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
hf 14a list & CmdTraceListAlias: simplify
This commit is contained in:
parent
4dea429157
commit
2e925d5da3
3 changed files with 19 additions and 21 deletions
|
@ -171,14 +171,7 @@ static uint16_t frameLength = 0;
|
|||
uint16_t atsFSC[] = {16, 24, 32, 40, 48, 64, 96, 128, 256};
|
||||
|
||||
static int CmdHF14AList(const char *Cmd) {
|
||||
int ret = CmdTraceListAlias(Cmd, "hf 14a list");
|
||||
if (ret != PM3_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
char args[128] = {0};
|
||||
snprintf(args, sizeof(args), "-t 14a ");
|
||||
strncat(args, Cmd, sizeof(args) - strlen(args));
|
||||
return CmdTraceList(args);
|
||||
return CmdTraceListAlias(Cmd, "hf 14a", "14a");
|
||||
}
|
||||
|
||||
int hf14a_getconfig(hf14a_config *config) {
|
||||
|
|
|
@ -591,19 +591,22 @@ static int CmdTraceSave(const char *Cmd) {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
int CmdTraceListAlias(const char *Cmd, const char *alias) {
|
||||
int CmdTraceListAlias(const char *Cmd, const char *alias, const char *protocol) {
|
||||
CLIParserContext *ctx;
|
||||
char desc[500] = {0};
|
||||
snprintf(desc, sizeof(desc) - 1,
|
||||
"Alias of `trace list -t %s` with selected protocol data to annotate trace buffer\n"
|
||||
"You can load a trace from file (see `trace load -h`) or it be downloaded from device by default\n"
|
||||
"It accepts all other arguments of `trace list`. Note that some might not be relevant for this specific protocol",
|
||||
protocol);
|
||||
char example[200] = {0};
|
||||
sprintf(example,
|
||||
"%s -f -> show frame delay times\n"
|
||||
"%s -1 -> use trace buffer ",
|
||||
snprintf(example, sizeof(example) - 1,
|
||||
"%s list -f -> show frame delay times\n"
|
||||
"%s list -1 -> use trace buffer ",
|
||||
alias, alias);
|
||||
CLIParserInit(&ctx, alias,
|
||||
"Alias of `trace list -t` with selected protocol data to annotate trace buffer\n"
|
||||
"You can load a trace from file (see `trace load -h`) or it be downloaded from device by default\n"
|
||||
"It accepts all other arguments of `trace list`. Note that some might not be relevant for this specific protocol",
|
||||
example
|
||||
);
|
||||
char fullalias[100] = {0};
|
||||
snprintf(fullalias, sizeof(fullalias) - 1, "%s list", alias);
|
||||
CLIParserInit(&ctx, fullalias, desc, example);
|
||||
|
||||
void *argtable[] = {
|
||||
arg_param_begin,
|
||||
|
@ -618,8 +621,10 @@ int CmdTraceListAlias(const char *Cmd, const char *alias) {
|
|||
arg_param_end
|
||||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
CLIParserFree(ctx);
|
||||
return PM3_SUCCESS;
|
||||
char args[128] = {0};
|
||||
snprintf(args, sizeof(args), "-t %s ", protocol);
|
||||
strncat(args, Cmd, sizeof(args) - strlen(args));
|
||||
return CmdTraceList(args);
|
||||
}
|
||||
|
||||
int CmdTraceList(const char *Cmd) {
|
||||
|
|
|
@ -15,6 +15,6 @@
|
|||
|
||||
int CmdTrace(const char *Cmd);
|
||||
int CmdTraceList(const char *Cmd);
|
||||
int CmdTraceListAlias(const char *Cmd, const char *alias);
|
||||
int CmdTraceListAlias(const char *Cmd, const char *alias, const char *protocol);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue