mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 13:53:55 -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};
|
uint16_t atsFSC[] = {16, 24, 32, 40, 48, 64, 96, 128, 256};
|
||||||
|
|
||||||
static int CmdHF14AList(const char *Cmd) {
|
static int CmdHF14AList(const char *Cmd) {
|
||||||
int ret = CmdTraceListAlias(Cmd, "hf 14a list");
|
return CmdTraceListAlias(Cmd, "hf 14a", "14a");
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int hf14a_getconfig(hf14a_config *config) {
|
int hf14a_getconfig(hf14a_config *config) {
|
||||||
|
|
|
@ -591,19 +591,22 @@ static int CmdTraceSave(const char *Cmd) {
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CmdTraceListAlias(const char *Cmd, const char *alias) {
|
int CmdTraceListAlias(const char *Cmd, const char *alias, const char *protocol) {
|
||||||
CLIParserContext *ctx;
|
CLIParserContext *ctx;
|
||||||
char example[200] = {0};
|
char desc[500] = {0};
|
||||||
sprintf(example,
|
snprintf(desc, sizeof(desc) - 1,
|
||||||
"%s -f -> show frame delay times\n"
|
"Alias of `trace list -t %s` with selected protocol data to annotate trace buffer\n"
|
||||||
"%s -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"
|
"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",
|
"It accepts all other arguments of `trace list`. Note that some might not be relevant for this specific protocol",
|
||||||
example
|
protocol);
|
||||||
);
|
char example[200] = {0};
|
||||||
|
snprintf(example, sizeof(example) - 1,
|
||||||
|
"%s list -f -> show frame delay times\n"
|
||||||
|
"%s list -1 -> use trace buffer ",
|
||||||
|
alias, alias);
|
||||||
|
char fullalias[100] = {0};
|
||||||
|
snprintf(fullalias, sizeof(fullalias) - 1, "%s list", alias);
|
||||||
|
CLIParserInit(&ctx, fullalias, desc, example);
|
||||||
|
|
||||||
void *argtable[] = {
|
void *argtable[] = {
|
||||||
arg_param_begin,
|
arg_param_begin,
|
||||||
|
@ -618,8 +621,10 @@ int CmdTraceListAlias(const char *Cmd, const char *alias) {
|
||||||
arg_param_end
|
arg_param_end
|
||||||
};
|
};
|
||||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||||
CLIParserFree(ctx);
|
char args[128] = {0};
|
||||||
return PM3_SUCCESS;
|
snprintf(args, sizeof(args), "-t %s ", protocol);
|
||||||
|
strncat(args, Cmd, sizeof(args) - strlen(args));
|
||||||
|
return CmdTraceList(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CmdTraceList(const char *Cmd) {
|
int CmdTraceList(const char *Cmd) {
|
||||||
|
|
|
@ -15,6 +15,6 @@
|
||||||
|
|
||||||
int CmdTrace(const char *Cmd);
|
int CmdTrace(const char *Cmd);
|
||||||
int CmdTraceList(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
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue