mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
hf 14a info: added verbose, command optimization, move it to cliparser
This commit is contained in:
parent
6eb7c8e7a5
commit
8befad6d34
3 changed files with 42 additions and 28 deletions
|
@ -227,13 +227,6 @@ static int usage_hf_14a_reader(void) {
|
|||
PrintAndLogEx(NORMAL, " 3 ISO14443-3 select only (skip RATS)");
|
||||
return 0;
|
||||
}
|
||||
static int usage_hf_14a_info(void) {
|
||||
PrintAndLogEx(NORMAL, "This command makes more extensive tests against a ISO14443a tag in order to collect information");
|
||||
PrintAndLogEx(NORMAL, "Usage: hf 14a info [h|s]");
|
||||
PrintAndLogEx(NORMAL, " s silent (no messages)");
|
||||
PrintAndLogEx(NORMAL, " n test for nack bug");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int CmdHF14AList(const char *Cmd) {
|
||||
(void)Cmd; // Cmd is not used so far
|
||||
|
@ -368,12 +361,30 @@ static int CmdHF14AReader(const char *Cmd) {
|
|||
}
|
||||
|
||||
static int CmdHF14AInfo(const char *Cmd) {
|
||||
bool verbose = false;
|
||||
bool do_nack_test = false;
|
||||
bool do_aid_search = false;
|
||||
|
||||
if (Cmd[0] == 'h' || Cmd[0] == 'H') return usage_hf_14a_info();
|
||||
CLIParserInit("hf 14a info",
|
||||
"This command makes more extensive tests against a ISO14443a tag in order to collect information",
|
||||
"Sample:\n\thf 14a info -nsv - shows full information about the card\n");
|
||||
|
||||
bool verbose = !(Cmd[0] == 's' || Cmd[0] == 'S');
|
||||
bool do_nack_test = (Cmd[0] == 'n' || Cmd[0] == 'N');
|
||||
infoHF14A(verbose, do_nack_test, true);
|
||||
void *argtable[] = {
|
||||
arg_param_begin,
|
||||
arg_lit0("vV", "verbose", "adds some information to results"),
|
||||
arg_lit0("nN", "naktest", "test for nack bug"),
|
||||
arg_lit0("sS", "aidsearch", "checks if AIDs from aidlist.json is present on the card and prints information about found AIDs"),
|
||||
arg_param_end
|
||||
};
|
||||
CLIExecWithReturn(Cmd, argtable, true);
|
||||
|
||||
verbose = arg_get_lit(1);
|
||||
do_nack_test = arg_get_lit(2);
|
||||
do_aid_search = arg_get_lit(3);
|
||||
|
||||
CLIParserFree();
|
||||
|
||||
infoHF14A(verbose, do_nack_test, do_aid_search);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1497,7 +1508,7 @@ int infoHF14A(bool verbose, bool do_nack_test, bool do_aid_search) {
|
|||
|
||||
if (do_aid_search) {
|
||||
int elmindx = 0;
|
||||
json_t *root = AIDSearchInit();
|
||||
json_t *root = AIDSearchInit(verbose);
|
||||
if (root != NULL) {
|
||||
bool ActivateField = true;
|
||||
for (elmindx = 0; elmindx < json_array_size(root); elmindx++) {
|
||||
|
@ -1516,14 +1527,14 @@ int infoHF14A(bool verbose, bool do_nack_test, bool do_aid_search) {
|
|||
continue;
|
||||
|
||||
if (sw == 0x9000) {
|
||||
PrintAndLogEx(NORMAL, "------------- Application OK -----------");
|
||||
if (verbose) PrintAndLogEx(NORMAL, "------------- Application OK -----------");
|
||||
PrintAndLogEx(NORMAL, "res: %s", sprint_hex(result, resultlen));
|
||||
PrintAIDDescriptionBuf(vaid, vaidlen, true);
|
||||
PrintAIDDescriptionBuf(root, vaid, vaidlen, verbose);
|
||||
}
|
||||
|
||||
if (sw == 0x6283 || sw == 0x6285) {
|
||||
PrintAndLogEx(NORMAL, "----------- Application blocked --------");
|
||||
PrintAIDDescriptionBuf(vaid, vaidlen, true);
|
||||
if (verbose) PrintAndLogEx(NORMAL, "----------- Application blocked --------");
|
||||
PrintAIDDescriptionBuf(root, vaid, vaidlen, verbose);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue