mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
Merge pull request #1088 from tcprst/topaz_cliparser
hf topaz - now use cliparser
This commit is contained in:
commit
2d2196afbe
2 changed files with 71 additions and 14 deletions
|
@ -14,6 +14,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
#include "cliparser.h"
|
||||||
#include "cmdparser.h" // command_t
|
#include "cmdparser.h" // command_t
|
||||||
#include "comms.h"
|
#include "comms.h"
|
||||||
#include "cmdtrace.h"
|
#include "cmdtrace.h"
|
||||||
|
@ -393,21 +394,42 @@ static int topaz_print_NDEF(uint8_t *data, size_t maxsize) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int CmdHFTopazReader(const char *Cmd) {
|
static int CmdHFTopazReader(const char *Cmd) {
|
||||||
|
CLIParserContext *ctx;
|
||||||
|
CLIParserInit(&ctx, "hf topaz reader",
|
||||||
|
"Read UID from Topaz tags",
|
||||||
|
"hf topaz reader");
|
||||||
|
|
||||||
bool verbose = true;
|
void *argtable[] = {
|
||||||
char ctmp = tolower(param_getchar(Cmd, 0));
|
arg_param_begin,
|
||||||
if (ctmp == 's') verbose = false;
|
arg_lit0("v", "verbose", "verbose output"),
|
||||||
|
arg_param_end
|
||||||
|
};
|
||||||
|
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||||
|
|
||||||
|
bool verbose = arg_get_lit(ctx, 1);
|
||||||
|
|
||||||
|
CLIParserFree(ctx);
|
||||||
|
|
||||||
return readTopazUid(verbose);
|
return readTopazUid(verbose);
|
||||||
}
|
}
|
||||||
|
|
||||||
// read a Topaz tag and print some useful information
|
// read a Topaz tag and print some useful information
|
||||||
static int CmdHFTopazInfo(const char *Cmd) {
|
static int CmdHFTopazInfo(const char *Cmd) {
|
||||||
|
CLIParserContext *ctx;
|
||||||
|
CLIParserInit(&ctx, "hf topaz info",
|
||||||
|
"Get info from Topaz tags",
|
||||||
|
"hf topaz info");
|
||||||
|
|
||||||
bool verbose = true;
|
void *argtable[] = {
|
||||||
char ctmp = tolower(param_getchar(Cmd, 0));
|
arg_param_begin,
|
||||||
if (ctmp == 's') verbose = false;
|
arg_lit0("v", "verbose", "verbose output"),
|
||||||
|
arg_param_end
|
||||||
|
};
|
||||||
|
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||||
|
|
||||||
|
bool verbose = arg_get_lit(ctx, 1);
|
||||||
|
|
||||||
|
CLIParserFree(ctx);
|
||||||
|
|
||||||
int status = readTopazUid(verbose);
|
int status = readTopazUid(verbose);
|
||||||
if (status != PM3_SUCCESS)
|
if (status != PM3_SUCCESS)
|
||||||
|
@ -469,13 +491,34 @@ static int CmdHFTopazInfo(const char *Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int CmdHFTopazSim(const char *Cmd) {
|
static int CmdHFTopazSim(const char *Cmd) {
|
||||||
(void)Cmd; // Cmd is not used so far
|
CLIParserContext *ctx;
|
||||||
|
CLIParserInit(&ctx, "hf topaz sim",
|
||||||
|
"Simulate a Topaz tag",
|
||||||
|
"hf topaz sim <- Not yet implemented");
|
||||||
|
|
||||||
|
void *argtable[] = {
|
||||||
|
arg_param_begin,
|
||||||
|
arg_param_end
|
||||||
|
};
|
||||||
|
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||||
|
CLIParserFree(ctx);
|
||||||
PrintAndLogEx(INFO, "not yet implemented");
|
PrintAndLogEx(INFO, "not yet implemented");
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int CmdHFTopazCmdRaw(const char *Cmd) {
|
static int CmdHFTopazCmdRaw(const char *Cmd) {
|
||||||
(void)Cmd; // Cmd is not used so far
|
CLIParserContext *ctx;
|
||||||
|
CLIParserInit(&ctx, "hf topaz raw",
|
||||||
|
"Send raw hex data to Topaz tags",
|
||||||
|
"hf topaz raw <- Not yet implemented");
|
||||||
|
|
||||||
|
void *argtable[] = {
|
||||||
|
arg_param_begin,
|
||||||
|
arg_param_end
|
||||||
|
};
|
||||||
|
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||||
|
CLIParserFree(ctx);
|
||||||
|
|
||||||
PrintAndLogEx(INFO, "not yet implemented. Use hf 14 raw with option -T.");
|
PrintAndLogEx(INFO, "not yet implemented. Use hf 14 raw with option -T.");
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -490,6 +533,25 @@ static int CmdHFTopazList(const char *Cmd) {
|
||||||
return CmdTraceList(args);
|
return CmdTraceList(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int CmdHFTopazSniff(const char *Cmd) {
|
||||||
|
CLIParserContext *ctx;
|
||||||
|
CLIParserInit(&ctx, "hf topaz sniff",
|
||||||
|
"Sniff Topaz reader-tag communication",
|
||||||
|
"hf topaz sniff");
|
||||||
|
|
||||||
|
void *argtable[] = {
|
||||||
|
arg_param_begin,
|
||||||
|
arg_param_end
|
||||||
|
};
|
||||||
|
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||||
|
CLIParserFree(ctx);
|
||||||
|
|
||||||
|
uint8_t param = 0;
|
||||||
|
SendCommandNG(CMD_HF_ISO14443A_SNIFF, (uint8_t *)¶m, sizeof(uint8_t));
|
||||||
|
|
||||||
|
return PM3_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
static int CmdHelp(const char *Cmd);
|
static int CmdHelp(const char *Cmd);
|
||||||
|
|
||||||
static command_t CommandTable[] = {
|
static command_t CommandTable[] = {
|
||||||
|
@ -498,7 +560,7 @@ static command_t CommandTable[] = {
|
||||||
{"info", CmdHFTopazInfo, IfPm3Iso14443a, "Tag information"},
|
{"info", CmdHFTopazInfo, IfPm3Iso14443a, "Tag information"},
|
||||||
{"reader", CmdHFTopazReader, IfPm3Iso14443a, "Act like a Topaz reader"},
|
{"reader", CmdHFTopazReader, IfPm3Iso14443a, "Act like a Topaz reader"},
|
||||||
{"sim", CmdHFTopazSim, IfPm3Iso14443a, "<UID> -- Simulate Topaz tag"},
|
{"sim", CmdHFTopazSim, IfPm3Iso14443a, "<UID> -- Simulate Topaz tag"},
|
||||||
{"sniff", CmdHF14ASniff, IfPm3Iso14443a, "Sniff Topaz reader-tag communication"},
|
{"sniff", CmdHFTopazSniff, IfPm3Iso14443a, "Sniff Topaz reader-tag communication"},
|
||||||
{"raw", CmdHFTopazCmdRaw, IfPm3Iso14443a, "Send raw hex data to tag"},
|
{"raw", CmdHFTopazCmdRaw, IfPm3Iso14443a, "Send raw hex data to tag"},
|
||||||
{NULL, NULL, 0, NULL}
|
{NULL, NULL, 0, NULL}
|
||||||
};
|
};
|
||||||
|
|
|
@ -141,11 +141,6 @@ hf mfu otptear
|
||||||
hf mfdes enum
|
hf mfdes enum
|
||||||
hf mfdes getuid
|
hf mfdes getuid
|
||||||
hf mfdes info
|
hf mfdes info
|
||||||
hf topaz info
|
|
||||||
hf topaz reader
|
|
||||||
hf topaz sim
|
|
||||||
hf topaz sniff
|
|
||||||
hf topaz raw
|
|
||||||
hw connect
|
hw connect
|
||||||
hw dbg
|
hw dbg
|
||||||
hw detectreader
|
hw detectreader
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue