adapt list command to allow for options

This commit is contained in:
iceman1001 2020-10-09 20:19:36 +02:00
parent 627a361666
commit 64a44d1e85
16 changed files with 98 additions and 56 deletions

View file

@ -269,9 +269,11 @@ static int usage_hf_14a_reader(void) {
}
static int CmdHF14AList(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
CmdTraceList("14a");
return 0;
char args[128];
if (strlen(Cmd) == 0) {
snprintf(args, sizeof(args), "-t 14a");
}
return CmdTraceList(args);
}
int hf14a_getconfig(hf14a_config *config) {

View file

@ -116,9 +116,11 @@ static bool wait_cmd_14b(bool verbose, bool is_select) {
}
static int CmdHF14BList(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
CmdTraceList("14b");
return PM3_SUCCESS;
char args[128];
if (strlen(Cmd) == 0) {
snprintf(args, sizeof(args), "-t 14b");
}
return CmdTraceList(args);
}
static int CmdHF14BSim(const char *Cmd) {

View file

@ -1342,9 +1342,11 @@ static int CmdHF15Dump(const char *Cmd) {
}
static int CmdHF15List(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
CmdTraceList("15");
return PM3_SUCCESS;
char args[128];
if (strlen(Cmd) == 0) {
snprintf(args, sizeof(args), "-t 15");
}
return CmdTraceList(args);
}
static int CmdHF15Raw(const char *Cmd) {

View file

@ -115,9 +115,11 @@ static int switch_off_field_cryptorf(void) {
}
static int CmdHFCryptoRFList(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
CmdTraceList("cryptorf");
return PM3_SUCCESS;
char args[128];
if (strlen(Cmd) == 0) {
snprintf(args, sizeof(args), "-t cryptorf");
}
return CmdTraceList(args);
}
static int CmdHFCryptoRFSim(const char *Cmd) {

View file

@ -407,9 +407,11 @@ static bool add_last_IDm(uint8_t position, uint8_t *data) {
}
static int CmdHFFelicaList(const char *Cmd) {
(void)Cmd;
CmdTraceList("felica");
return PM3_SUCCESS;
char args[128];
if (strlen(Cmd) == 0) {
snprintf(args, sizeof(args), "-t felica");
}
return CmdTraceList(args);
}
static int CmdHFFelicaReader(const char *Cmd) {

View file

@ -36,10 +36,19 @@
#include "emv/dump.h"
#include "ui.h"
#include "cmdhf14a.h"
#include "cmdtrace.h"
static int CmdHelp(const char *Cmd);
static int CmdHFFidoInfo(const char *cmd) {
static int cmd_hf_fido_list(const char *Cmd) {
char args[128];
if (strlen(Cmd) == 0) {
snprintf(args, sizeof(args), "-t 14a");
}
return CmdTraceList(args);
}
static int cmd_hf_fido_info(const char *cmd) {
if (cmd && strlen(cmd) > 0)
PrintAndLogEx(WARNING, "WARNING: command doesn't have any parameters.\n");
@ -150,7 +159,7 @@ static json_t *OpenJson(CLIParserContext *ctx, int paramnum, char *fname, void *
return root;
}
static int CmdHFFidoRegister(const char *cmd) {
static int cmd_hf_fido_register(const char *cmd) {
uint8_t data[64] = {0};
int chlen = 0;
uint8_t cdata[250] = {0};
@ -386,7 +395,7 @@ static int CmdHFFidoRegister(const char *cmd) {
return PM3_SUCCESS;
}
static int CmdHFFidoAuthenticate(const char *cmd) {
static int cmd_hf_fido_authenticate(const char *cmd) {
uint8_t data[512] = {0};
uint8_t hdata[250] = {0};
bool public_key_loaded = false;
@ -652,7 +661,7 @@ static int GetExistsFileNameJson(const char *prefixDir, const char *reqestedFile
return PM3_SUCCESS;
}
static int CmdHFFido2MakeCredential(const char *cmd) {
static int cmd_hf_fido_2make_credential(const char *cmd) {
json_error_t error;
char fname[FILE_PATH_SIZE] = {0};
@ -777,7 +786,7 @@ static int CmdHFFido2MakeCredential(const char *cmd) {
return PM3_SUCCESS;
}
static int CmdHFFido2GetAssertion(const char *cmd) {
static int cmd_hf_fido_2get_assertion(const char *cmd) {
json_error_t error;
char fname[FILE_PATH_SIZE] = {0};
@ -903,13 +912,14 @@ static int CmdHFFido2GetAssertion(const char *cmd) {
}
static command_t CommandTable[] = {
{"help", CmdHelp, AlwaysAvailable, "This help."},
{"info", CmdHFFidoInfo, IfPm3Iso14443a, "Info about FIDO tag."},
{"reg", CmdHFFidoRegister, IfPm3Iso14443a, "FIDO U2F Registration Message."},
{"auth", CmdHFFidoAuthenticate, IfPm3Iso14443a, "FIDO U2F Authentication Message."},
{"make", CmdHFFido2MakeCredential, IfPm3Iso14443a, "FIDO2 MakeCredential command."},
{"assert", CmdHFFido2GetAssertion, IfPm3Iso14443a, "FIDO2 GetAssertion command."},
{NULL, NULL, 0, NULL}
{"help", CmdHelp, AlwaysAvailable, "This help."},
{"info", cmd_hf_fido_list, IfPm3Iso14443a, "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."},
{"make", cmd_hf_fido_2make_credential, IfPm3Iso14443a, "FIDO2 MakeCredential command."},
{"assert", cmd_hf_fido_2get_assertion, IfPm3Iso14443a, "FIDO2 GetAssertion command."},
{NULL, NULL, 0, NULL}
};
int CmdHFFido(const char *Cmd) {

View file

@ -604,9 +604,11 @@ static void print_picopass_header(const picopass_hdr *hdr) {
}
static int CmdHFiClassList(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
CmdTraceList("iclass");
return PM3_SUCCESS;
char args[128];
if (strlen(Cmd) == 0) {
snprintf(args, sizeof(args), "-t iclass");
}
return CmdTraceList(args);
}
static int CmdHFiClassSniff(const char *Cmd) {

View file

@ -1401,9 +1401,11 @@ static int CmdLegicWipe(const char *Cmd) {
}
static int CmdLegicList(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
CmdTraceList("legic");
return PM3_SUCCESS;
char args[128];
if (strlen(Cmd) == 0) {
snprintf(args, sizeof(args), "-t legic");
}
return CmdTraceList(args);
}
static command_t CommandTable[] = {

View file

@ -207,9 +207,11 @@ int infoLTO(bool verbose) {
}
static int CmdHfLTOList(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
CmdTraceList("lto");
return PM3_SUCCESS;
char args[128];
if (strlen(Cmd) == 0) {
snprintf(args, sizeof(args), "-t lto");
}
return CmdTraceList(args);
}
static int lto_rdbl(uint8_t blk, uint8_t *block_responce, uint8_t *block_cnt_responce, bool verbose) {

View file

@ -5196,8 +5196,11 @@ static int CmdHFMFPersonalize(const char *cmd) {
}
static int CmdHF14AMfList(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
return CmdTraceList("mf");
char args[128];
if (strlen(Cmd) == 0) {
snprintf(args, sizeof(args), "-t mf");
}
return CmdTraceList(args);
}
static int CmdHf14AGen3UID(const char *Cmd) {

View file

@ -4470,8 +4470,11 @@ static int CmdHF14aDesChk(const char *Cmd) {
}
static int CmdHF14ADesList(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
return CmdTraceList("des");
char args[128];
if (strlen(Cmd) == 0) {
snprintf(args, sizeof(args), "-t des");
}
return CmdTraceList(args);
}
/*

View file

@ -724,9 +724,11 @@ static int cmd_hf_st_pwd(const char *Cmd) {
}
static int cmd_hf_st_list(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
CmdTraceList("7816");
return PM3_SUCCESS;
char args[128];
if (strlen(Cmd) == 0) {
snprintf(args, sizeof(args), "-t 7816");
}
return CmdTraceList(args);
}
static command_t CommandTable[] = {

View file

@ -118,7 +118,6 @@ static int print_barcode(uint8_t *barcode, const size_t barcode_len, bool verbos
return PM3_SUCCESS;
}
static int CmdHfThinFilmInfo(const char *Cmd) {
uint8_t cmdp = 0;
@ -226,9 +225,11 @@ static int CmdHfThinFilmSim(const char *Cmd) {
}
static int CmdHfThinFilmList(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
CmdTraceList("thinfilm");
return PM3_SUCCESS;
char args[128];
if (strlen(Cmd) == 0) {
snprintf(args, sizeof(args), "-t thinfilm");
}
return CmdTraceList(args);
}
static command_t CommandTable[] = {

View file

@ -481,9 +481,11 @@ static int CmdHFTopazCmdRaw(const char *Cmd) {
}
static int CmdHFTopazList(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
CmdTraceList("topaz");
return PM3_SUCCESS;
char args[128];
if (strlen(Cmd) == 0) {
snprintf(args, sizeof(args), "-t topaz");
}
return CmdTraceList(args);
}
static int CmdHelp(const char *Cmd);

View file

@ -149,9 +149,12 @@ static int usage_hitag_checkchallenges(void) {
}
static int CmdLFHitagList(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
CmdTraceList("hitag2");
return PM3_SUCCESS;
char args[128];
if (strlen(Cmd) == 0) {
snprintf(args, sizeof(args), "-t hitag2");
}
return CmdTraceList(args);
/*
uint8_t *got = calloc(PM3_CMD_DATA_SIZE, sizeof(uint8_t));

View file

@ -844,9 +844,11 @@ static int CmdSmartSetClock(const char *Cmd) {
}
static int CmdSmartList(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
CmdTraceList("7816");
return PM3_SUCCESS;
char args[128];
if (strlen(Cmd) == 0) {
snprintf(args, sizeof(args), "-t 7816");
}
return CmdTraceList(args);
}
static void smart_brute_prim(void) {