mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-01-25 09:33:10 +08:00
added file name to fido2 command
This commit is contained in:
parent
fc9558b18f
commit
bad7b80036
1 changed files with 40 additions and 15 deletions
|
@ -876,7 +876,7 @@ int CmdHFFido2MakeCredential(const char *cmd) {
|
||||||
arg_litn("vV", "verbose", 0, 2, "show technical data. vv - show full certificates data"),
|
arg_litn("vV", "verbose", 0, 2, "show technical data. vv - show full certificates data"),
|
||||||
arg_lit0("tT", "tlv", "Show DER certificate contents in TLV representation"),
|
arg_lit0("tT", "tlv", "Show DER certificate contents in TLV representation"),
|
||||||
arg_lit0("cC", "cbor", "show CBOR decoded data"),
|
arg_lit0("cC", "cbor", "show CBOR decoded data"),
|
||||||
arg_str0(NULL, NULL, "fido2.json", "JSON input / output file name for parameters. Default `fido2.json`"),
|
arg_str0(NULL, NULL, "<json file name>", "JSON input / output file name for parameters. Default `fido2.json`"),
|
||||||
arg_param_end
|
arg_param_end
|
||||||
};
|
};
|
||||||
CLIExecWithReturn(cmd, argtable, true);
|
CLIExecWithReturn(cmd, argtable, true);
|
||||||
|
@ -887,15 +887,21 @@ int CmdHFFido2MakeCredential(const char *cmd) {
|
||||||
bool showDERTLV = arg_get_lit(3);
|
bool showDERTLV = arg_get_lit(3);
|
||||||
bool showCBOR = arg_get_lit(4);
|
bool showCBOR = arg_get_lit(4);
|
||||||
|
|
||||||
|
uint8_t jsonname[250] ={0};
|
||||||
|
char *cjsonname = (char *)jsonname;
|
||||||
|
int jsonnamelen = 0;
|
||||||
|
CLIGetStrWithReturn(5, jsonname, &jsonnamelen);
|
||||||
|
|
||||||
|
if (!jsonnamelen) {
|
||||||
|
strcat(cjsonname, "fido2");
|
||||||
|
jsonnamelen = strlen(cjsonname);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CLIParserFree();
|
CLIParserFree();
|
||||||
|
|
||||||
SetAPDULogging(APDULogging);
|
SetAPDULogging(APDULogging);
|
||||||
|
|
||||||
int res = GetExistsFileNameJson("fido", "fido2", fname);
|
int res = GetExistsFileNameJson("fido", cjsonname, fname);
|
||||||
if(res) {
|
if(res) {
|
||||||
PrintAndLog("ERROR: Can't found the json file.");
|
PrintAndLog("ERROR: Can't found the json file.");
|
||||||
return res;
|
return res;
|
||||||
|
@ -986,21 +992,40 @@ int CmdHFFido2GetAssertion(const char *cmd) {
|
||||||
json_t *root = NULL;
|
json_t *root = NULL;
|
||||||
char fname[300] = {0};
|
char fname[300] = {0};
|
||||||
|
|
||||||
|
CLIParserInit("hf fido assert",
|
||||||
bool APDULogging = false;
|
"Execute a FIDO2 Get Assertion command. Needs json file with parameters. Sample file `fido2.json`. File can be placed in proxmark directory or in `proxmark/fido` directory.",
|
||||||
bool verbose = true;
|
"Usage:\n\thf fido assert -> execute command default parameters file `fido2.json`\n"
|
||||||
bool verbose2 = true;
|
"\thf fido assert test.json -> execute command with parameters file `text.json`");
|
||||||
bool showCBOR = true;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void* argtable[] = {
|
||||||
|
arg_param_begin,
|
||||||
|
arg_lit0("aA", "apdu", "show APDU reqests and responses"),
|
||||||
|
arg_litn("vV", "verbose", 0, 2, "show technical data. vv - show full certificates data"),
|
||||||
|
arg_lit0("cC", "cbor", "show CBOR decoded data"),
|
||||||
|
arg_str0(NULL, NULL, "<json file name>", "JSON input / output file name for parameters. Default `fido2.json`"),
|
||||||
|
arg_param_end
|
||||||
|
};
|
||||||
|
CLIExecWithReturn(cmd, argtable, true);
|
||||||
|
|
||||||
|
bool APDULogging = arg_get_lit(1);
|
||||||
//CLIParserFree();
|
bool verbose = arg_get_lit(2);
|
||||||
|
bool verbose2 = arg_get_lit(2) > 1;
|
||||||
|
bool showCBOR = arg_get_lit(3);
|
||||||
|
|
||||||
|
uint8_t jsonname[250] ={0};
|
||||||
|
char *cjsonname = (char *)jsonname;
|
||||||
|
int jsonnamelen = 0;
|
||||||
|
CLIGetStrWithReturn(4, jsonname, &jsonnamelen);
|
||||||
|
|
||||||
|
if (!jsonnamelen) {
|
||||||
|
strcat(cjsonname, "fido2");
|
||||||
|
jsonnamelen = strlen(cjsonname);
|
||||||
|
}
|
||||||
|
|
||||||
|
CLIParserFree();
|
||||||
|
|
||||||
SetAPDULogging(APDULogging);
|
SetAPDULogging(APDULogging);
|
||||||
|
|
||||||
|
|
||||||
int res = GetExistsFileNameJson("fido", "fido2", fname);
|
int res = GetExistsFileNameJson("fido", "fido2", fname);
|
||||||
if(res) {
|
if(res) {
|
||||||
PrintAndLog("ERROR: Can't found the json file.");
|
PrintAndLog("ERROR: Can't found the json file.");
|
||||||
|
|
Loading…
Reference in a new issue