diff --git a/CHANGELOG.md b/CHANGELOG.md index 5dd9716af..376b79059 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file. This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log... ## [unreleased][unreleased] +- Changed client tab completion - vocabulary is now built at runtime from the live command tree and uses the same availability rules as `help`, removing the generated `pm3line_vocabulary.h` and `pm3_help2list.py` (@Msprg) - Fixed standalone modes - the one second button hold trigger was a no-op on all non-PM5 platforms, leaving `hw standalone` over USB as the only entry point (@ShawInnes) - Added `sim022.bin` - enabled burst mode transfers, which allows us to do TA1=96 in speeds (@iceman1001) - Fixed `hf felica liteauth` - empty long option names for `-c` and `-k` made argtable read past the string (found by ASAN on `--fulltext`) (@Msprg) diff --git a/Makefile b/Makefile index 45a2907be..712bf8fbd 100644 --- a/Makefile +++ b/Makefile @@ -228,7 +228,7 @@ help: @echo "+ fpga_compress - Make tools/fpga_compress" @echo @echo "+ style - Apply some automated source code formatting rules" - @echo "+ commands - Regenerate commands documentation files and autocompletion data" + @echo "+ commands - Regenerate commands documentation files (doc/commands.md, doc/commands.json)" @echo "+ check - Run offline tests. Set CHECKARGS to pass arguments to the test script" @echo "+ .../check - Run offline tests against specific target. See above." @echo "+ miscchecks - Detect various encoding issues in source code" @@ -361,8 +361,6 @@ commands: client @command -v python3 >/dev/null || ( echo "Please install 'python3' package first" ; exit 1 ) # Update commands.json, patch port in case it was run under Windows [ -x client/proxmark3 ] && client/proxmark3 --fulltext | sed 's#com[0-9]#/dev/ttyACM0#'|python3 client/pyscripts/pm3_help2json.py - - | tr -d '\r' > doc/commands.json - # Update the readline autocomplete autogenerated code - [ -x client/proxmark3 ] && client/proxmark3 --fulltext | python3 client/pyscripts/pm3_help2list.py - - | tr -d '\r' > client/src/pm3line_vocabulary.h # Detecting weird codepages and tabs. diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 43499107f..403f67a49 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -516,6 +516,7 @@ set (TARGET_SOURCES ${PM3_ROOT}/client/src/pm3_fit.c ${PM3_ROOT}/client/src/pm3line.c + ${PM3_ROOT}/client/src/pm3line_vocabulary.c ${PM3_ROOT}/client/src/scandir.c ${PM3_ROOT}/client/src/scripting.c ${PM3_ROOT}/client/src/ui.c diff --git a/client/Makefile b/client/Makefile index 88aee3eea..0cac5c1a2 100644 --- a/client/Makefile +++ b/client/Makefile @@ -912,6 +912,7 @@ SRCS = mifare/aiddesfire.c \ pm3_fit.c \ preferences.c \ pm3line.c \ + pm3line_vocabulary.c \ proxmark3.c \ scandir.c \ relay/relay_posix.c \ diff --git a/client/experimental_lib/CMakeLists.txt b/client/experimental_lib/CMakeLists.txt index 2636ea958..5d2d906a1 100644 --- a/client/experimental_lib/CMakeLists.txt +++ b/client/experimental_lib/CMakeLists.txt @@ -435,6 +435,7 @@ set (TARGET_SOURCES ${PM3_ROOT}/client/src/pm3_dsp.c ${PM3_ROOT}/client/src/pm3_fit.c ${PM3_ROOT}/client/src/pm3line.c + ${PM3_ROOT}/client/src/pm3line_vocabulary.c ${PM3_ROOT}/client/src/scandir.c ${PM3_ROOT}/client/src/scripting.c ${PM3_ROOT}/client/src/ui.c diff --git a/client/pyscripts/pm3_help2list.py b/client/pyscripts/pm3_help2list.py deleted file mode 100755 index c91a0bf3f..000000000 --- a/client/pyscripts/pm3_help2list.py +++ /dev/null @@ -1,231 +0,0 @@ -#!/usr/bin/env python3 -""" -PM3 Help 2 List - -This script takes the full text help output from the PM3 client and converts it to a list to be used for readline autocomplete. - -It is based on pm3_help2JSON.py by -Original Authors / Maintainers: - - Samuel Windall - -This version - - Iceman - -Note: - This script is used as a helper script to generate the pm3line_vocabulary.h file. - It need a working proxmark3 client to extract the help text. - - Ie: this script can't be used inside the normal build sequence. -""" - -import re -import datetime -import argparse -import logging -from pathlib import Path -import subprocess - -############################################################################## -# Script version data: (Please increment when making updates) - -APP_NAME = 'PM3Help2List' - -VERSION_MAJOR = 1 -VERSION_MINOR = 0 - -############################################################################## -# Main Application Code: - - -def main(): - """The main function for the script""" - args = build_arg_parser().parse_args() - logging_format = '%(message)s' - if args.debug: - logging.basicConfig(level=logging.DEBUG, format=logging_format) - else: - logging.basicConfig(level=logging.WARN, format=logging_format) - logging.info(f'{get_version()} starting...') - help_text = args.input_file.read() - command_data = parse_all_command_data(help_text) - # Collect all git-tracked scripts - paths = [('*.py', Path(__file__).parent), - ('*.lua', Path(__file__).parent.parent / 'luascripts'), - ('*.cmd', Path(__file__).parent.parent / 'cmdscripts')] - try: - for pattern, scripts_dir in paths: - result = subprocess.run(['git', 'ls-files', pattern], - cwd=scripts_dir, - capture_output=True, - text=True, - check=True) - for file_path in result.stdout.strip().split('\n'): - if file_path: - file = Path(file_path) - command_data[file.name] = {'command': f'script run {file.name}', 'offline': False} - except subprocess.CalledProcessError: - print("Error, need git") - - args.output_file.write("""//----------------------------------------------------------------------------- -// Copyright (C) Proxmark3 contributors. See AUTHORS.md for details. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// See LICENSE.txt for the text of the license. -//----------------------------------------------------------------------------- -// readline auto complete utilities -//----------------------------------------------------------------------------- - -#ifndef PM3LINE_VOCABULARY_H__ -#define PM3LINE_VOCABULARY_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -typedef struct vocabulary_s { - bool offline; - const char *name; -} vocabulary_t; - -const static vocabulary_t vocabulary[] = {\n""") - - for key, values in command_data.items(): - offline = 0 - if (values['offline'] == True): - offline = 1 - - cmd = values['command'] - - args.output_file.write(' {{ {}, "{}" }},\n'.format(offline, cmd)) - - args.output_file.write(""" {0, NULL}\n}; - -#ifdef __cplusplus -} -#endif - -#endif -""") - - logging.info(f'{get_version()} completed!') - - -def build_arg_parser(): - """Build the argument parser for reading the program arguments""" - parser = argparse.ArgumentParser() - parser.add_argument('input_file', type=argparse.FileType('r'), help='Source of full text help from the PM3 client.') - parser.add_argument('output_file', type=argparse.FileType('w'), help='Destination for list output.') - parser.add_argument('--version', '-v', action='version', version=get_version(), help='Version data about this app.') - parser.add_argument('--debug', '-d', action='store_true', help='Log debug messages.') - return parser - - -def build_help_regex(): - """The regex uses to parse the full text output of help data from the pm3 client.""" - # Reads the divider followed by the command itself - re_command = r'-{87}\n(?P.+)\n' - - # Reads if the command is available offline - re_offline = r'available offline: (?Pyes|no)\n+' - - return re.compile(re_command+re_offline, re.MULTILINE); - - -def parse_all_command_data(help_text): - """Turns the full text output of help data from the pm3 client into a list of dictionaries""" - command_dicts = {} - # Strip out ANSI escape sequences - help_text = remove_ansi_escape_codes(help_text) - # Find all commands in the full text help output - matches = build_help_regex().finditer(help_text) - for match in matches: - # Turn a match into a dictionary with keys for the extracted fields - command_object = parse_command_data(match) - # Store this command against its name for easy lookup - command_dicts[command_object['command']] = command_object - return command_dicts - - -def parse_command_data(match): - """Turns a regex match of a command in the help text and converts it into a dictionary""" - logging.info('Parsing new command...') - # Get and clean the command string - command = remove_extra_whitespace(match.group('command')) - logging.info(f' Command: {command}') - - # Get the online status as a boolean. Note: the regex only picks up 'yes' or 'no' so this check is safe. - offline = (match.group('offline') == 'yes') - logging.debug(f' Offline: {offline}') - - # Construct the command dictionary - command_data = { - 'command': command, - 'offline': offline, - } - logging.info('Completed parsing command!') - return command_data - - -############################################################################## -# Helper Functions: - - -def get_version(): - """Get the version string for this script""" - return f'{APP_NAME} v{VERSION_MAJOR}.{VERSION_MINOR:02}' - - -def remove_ansi_escape_codes(text): - """Remove ANSI escape sequences that may be left in the text.""" - re_ansi_escape = re.compile(r'(\x9B|\x1B\[)[0-?]*[ -/]*[@-~]') - return re_ansi_escape.sub('', str(text)).lower() - - -def remove_extra_whitespace(text): - """Removes extra whitespace that may be in the text.""" - # Ensure input is a string - text = str(text) - # Remove whitespace from the start and end of the text - text = text.strip() - # Deduplicate spaces in the string - text = re.sub(r' +', ' ', text) - return text - - -def text_to_oneliner(text): - """Converts a multi line string into a single line string and removes extra whitespace""" - # Ensure input is a string - text = str(text) - # Replace newlines with spaces - text = re.sub(r'\n+', ' ', text) - # Remove the extra whitespace - text = remove_extra_whitespace(text) - return text - - -def text_to_list(text): - """Converts a multi line string into a list of lines and removes extra whitespace""" - # Ensure input is a string - text = str(text) - # Get all the lines - lines = text.strip().split('\n') - # For each line clean up any extra whitespace - return [remove_extra_whitespace(line) for line in lines] - - -############################################################################## -# Application entrypoint: - -if __name__ == '__main__': - main() diff --git a/client/src/cmdparser.c b/client/src/cmdparser.c index 7e4c2a078..95133fa93 100644 --- a/client/src/cmdparser.c +++ b/client/src/cmdparser.c @@ -48,8 +48,6 @@ typedef pthread_mutex_t pthread_spinlock_t; pthread_mutex_destroy(lock) #endif -#define MAX_PM3_INPUT_ARGS_LENGTH 4096 - bool AlwaysAvailable(void) { return true; } @@ -309,8 +307,24 @@ static int execute_system_command(const char *command) { } +// Command tree walk state, see walkCommandsRecursive() +static command_visitor_t s_walk_visitor = NULL; +static void *s_walk_ctx = NULL; +static const command_t *s_walk_path[CMD_WALK_MAX_DEPTH]; +static size_t s_walk_depth = 0; +static size_t s_walk_dispatches = 0; + int CmdsParse(const command_t Commands[], const char *Cmd) { + // Command tree walk children, see walkCommandsRecursive(). + // Handled before the client_exe_delay: the walk enters here once per + // category and must not pay the delay every time. + if (strcmp(Cmd, "XX_internal_command_walk_XX") == 0) { + s_walk_dispatches++; + walkCommandsRecursive(Commands, s_walk_visitor, s_walk_ctx); + return PM3_SUCCESS; + } + if (g_session.client_exe_delay != 0) { msleep(g_session.client_exe_delay); } @@ -512,3 +526,49 @@ void dumpCommandsRecursive(const command_t cmds[], int markdown, bool full_help) ++i; } } + +void walkCommandsRecursive(const command_t cmds[], command_visitor_t visitor, void *ctx) { + if (cmds == NULL || cmds[0].Name == NULL || visitor == NULL) return; + + // Leaf commands first, then categories: same order as dumpCommandsRecursive() + for (int i = 0; cmds[i].Name; i++) { + if (cmds[i].Name[0] == '-' || strlen(cmds[i].Name) == 0) continue; + if (cmds[i].Help[0] == '{') continue; + + s_walk_path[s_walk_depth] = &cmds[i]; + visitor(s_walk_path, s_walk_depth + 1, ctx); + } + + for (int i = 0; cmds[i].Name; i++) { + if (cmds[i].Name[0] == '-' || strlen(cmds[i].Name) == 0) continue; + if (cmds[i].Help[0] != '{') continue; + + if (s_walk_depth + 1 >= CMD_WALK_MAX_DEPTH) { + PrintAndLogEx(DEBUG, "command tree too deep, skipping category %s", cmds[i].Name); + continue; + } + + command_visitor_t old_visitor = s_walk_visitor; + void *old_ctx = s_walk_ctx; + size_t dispatches = s_walk_dispatches; + s_walk_visitor = visitor; + s_walk_ctx = ctx; + s_walk_path[s_walk_depth++] = &cmds[i]; + + // This is what causes the recursion, since the category Parse-implementation + // in turn calls CmdsParse() on its own table. + cmds[i].Parse("XX_internal_command_walk_XX"); + + s_walk_depth--; + s_walk_visitor = old_visitor; + s_walk_ctx = old_ctx; + + // A few commands (e.g. "reveng") are shown like a category but are + // plain commands with their own parser. They never reach CmdsParse(), + // so report them as leaves. + if (s_walk_dispatches == dispatches) { + s_walk_path[s_walk_depth] = &cmds[i]; + visitor(s_walk_path, s_walk_depth + 1, ctx); + } + } +} diff --git a/client/src/cmdparser.h b/client/src/cmdparser.h index 1e3fde01c..7e49ababa 100644 --- a/client/src/cmdparser.h +++ b/client/src/cmdparser.h @@ -21,6 +21,8 @@ #include "common.h" +#define MAX_PM3_INPUT_ARGS_LENGTH 4096 + typedef struct command_s { const char *Name; int (*Parse)(const char *Cmd); @@ -29,6 +31,14 @@ typedef struct command_s { } command_t; // command_t array are expected to be NULL terminated +// Maximum nesting depth of the command tree supported by walkCommandsRecursive() +#define CMD_WALK_MAX_DEPTH 8 + +// Called by walkCommandsRecursive() for each leaf command. +// path[0..depth-1] are the command_t entries from the top level category +// down to the leaf command itself (path[depth-1]). +typedef void (*command_visitor_t)(const command_t *const path[], size_t depth, void *ctx); + // helpers for command_t IsAvailable bool AlwaysAvailable(void); bool IfClientDebugEnabled(void); @@ -70,5 +80,7 @@ void CmdsLS(const command_t Commands[]); // Parse a command line int CmdsParse(const command_t Commands[], const char *Cmd); void dumpCommandsRecursive(const command_t cmds[], int markdown, bool full_help); +// Walk the command tree, calling visitor for every leaf command +void walkCommandsRecursive(const command_t cmds[], command_visitor_t visitor, void *ctx); #endif diff --git a/client/src/pm3line.c b/client/src/pm3line.c index 5270a5fbe..137eacce3 100644 --- a/client/src/pm3line.c +++ b/client/src/pm3line.c @@ -35,27 +35,29 @@ #if defined(HAVE_READLINE) static char *rl_command_generator(const char *text, int state) { - static int index; + static size_t index; static size_t len; + static size_t count; + static const vocabulary_t *vocabulary; size_t rlen = strlen(rl_line_buffer); - const char *command; if (!state) { index = 0; len = strlen(text); + vocabulary = pm3line_vocabulary_get(&count); } - while ((command = vocabulary[index].name)) { + while (index < count) { - // When no pm3 device present - // and the command is not available offline, - // we skip it. - if ((g_session.pm3_present == false) && (vocabulary[index].offline == false)) { - index++; + const vocabulary_t *entry = &vocabulary[index++]; + + // Skip commands which are not available right now, + // using the same rules as "help" + if (pm3line_vocabulary_is_available(entry) == false) { continue; } - index++; + const char *command = entry->name; if (strncmp(command, rl_line_buffer, rlen) == 0) { const char *next = command + (rlen - len); @@ -77,22 +79,23 @@ static char **rl_command_completion(const char *text, int start, int end) { #elif defined(HAVE_LINENOISE) static void ln_command_completion(const char *text, linenoiseCompletions *lc) { - int index = 0; const char *prev_match = ""; size_t prev_match_len = 0; size_t len = strlen(text); - const char *command; - while ((command = vocabulary[index].name)) { + size_t count = 0; + const vocabulary_t *vocabulary = pm3line_vocabulary_get(&count); - // When no pm3 device present - // and the command is not available offline, - // we skip it. - if ((g_session.pm3_present == false) && (vocabulary[index].offline == false)) { - index++; + for (size_t index = 0; index < count; index++) { + + const vocabulary_t *entry = &vocabulary[index]; + + // Skip commands which are not available right now, + // using the same rules as "help" + if (pm3line_vocabulary_is_available(entry) == false) { continue; } - index++; + const char *command = entry->name; if (strncmp(command, text, len) == 0) { const char *space = strstr(command + len, " "); @@ -156,6 +159,10 @@ void pm3line_install_signals(void) { } void pm3line_init(void) { +#if defined(HAVE_READLINE) || defined(HAVE_LINENOISE) + // Build the completion vocabulary from the live command tree + pm3line_vocabulary_build(); +#endif #if defined(HAVE_READLINE) /* initialize history */ using_history(); @@ -203,6 +210,10 @@ void pm3line_free(void *ref) { free(ref); } +void pm3line_cleanup(void) { + pm3line_vocabulary_free(); +} + void pm3line_update_prompt(const char *prompt) { #if defined(HAVE_READLINE) rl_set_prompt(prompt); diff --git a/client/src/pm3line.h b/client/src/pm3line.h index a22f8540f..224ff700d 100644 --- a/client/src/pm3line.h +++ b/client/src/pm3line.h @@ -23,6 +23,7 @@ void pm3line_init(void); void pm3line_install_signals(void); char *pm3line_read(const char *s); void pm3line_free(void *ref); +void pm3line_cleanup(void); void pm3line_update_prompt(const char *prompt); int pm3line_load_history(const char *path); void pm3line_add_history(const char *line); diff --git a/client/src/pm3line_vocabulary.c b/client/src/pm3line_vocabulary.c new file mode 100644 index 000000000..e9fb9a679 --- /dev/null +++ b/client/src/pm3line_vocabulary.c @@ -0,0 +1,250 @@ +//----------------------------------------------------------------------------- +// Copyright (C) Proxmark3 contributors. See AUTHORS.md for details. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// See LICENSE.txt for the text of the license. +//----------------------------------------------------------------------------- +// Line editor auto complete vocabulary, built at runtime from the live +// command tree so it can never drift from what "help" shows. +//----------------------------------------------------------------------------- + +// this define is needed for scandir/alphasort to work +#define _GNU_SOURCE +#include "pm3line_vocabulary.h" +#include +#include +#include +#include "scandir.h" +#include "cmdmain.h" // getTopLevelCommandTable +#include "fileutils.h" // path_is_directory +#include "proxmark3.h" // get_my_executable_directory, get_my_user_directory +#include "ui.h" // PrintAndLogEx +#include "util.h" // str_dup, str_endswith, g_printAndLog + +#define VOCAB_INITIAL_CAPACITY 1024 +#define VOCAB_MAX_PATH 1024 + +static vocabulary_t *s_vocab = NULL; +static size_t s_count = 0; +static size_t s_capacity = 0; +static bool s_built = false; + +// Append an entry with the given name. Returns NULL if the name is already +// present or on allocation failure. +static vocabulary_t *vocab_add(const char *name) { + + for (size_t i = 0; i < s_count; i++) { + if (strcmp(s_vocab[i].name, name) == 0) { + return NULL; + } + } + + if (s_count == s_capacity) { + size_t new_capacity = s_capacity ? s_capacity * 2 : VOCAB_INITIAL_CAPACITY; + vocabulary_t *tmp = realloc(s_vocab, new_capacity * sizeof(vocabulary_t)); + if (tmp == NULL) { + PrintAndLogEx(WARNING, "Failed to allocate memory for completion vocabulary"); + return NULL; + } + s_vocab = tmp; + s_capacity = new_capacity; + } + + vocabulary_t *entry = &s_vocab[s_count]; + memset(entry, 0, sizeof(*entry)); + entry->name = str_dup(name); + if (entry->name == NULL) { + return NULL; + } + s_count++; + return entry; +} + +// Visitor for walkCommandsRecursive(): one call per leaf command. +static void vocab_visit_command(const command_t *const path[], size_t depth, void *ctx) { + (void) ctx; + + char name[MAX_PM3_INPUT_ARGS_LENGTH] = {0}; + size_t pos = 0; + for (size_t i = 0; i < depth; i++) { + int n = snprintf(name + pos, sizeof(name) - pos, "%s%s", i ? " " : "", path[i]->Name); + if (n < 0 || (size_t)n >= sizeof(name) - pos) { + return; + } + pos += (size_t)n; + } + + vocabulary_t *entry = vocab_add(name); + if (entry == NULL) { + return; + } + + entry->depth = (uint8_t)depth; + for (size_t i = 0; i < depth; i++) { + entry->is_available[i] = path[i]->IsAvailable; + } +} + +// Add "script run " entries for every script with extension ext found +// under dir (recursively), inheriting the availability of "script run" itself. +// rel is the path of dir relative to the script directory ("" or e.g. "examples/"), +// which is what "script run" needs to find a script in a subdirectory. +static void vocab_add_scripts_dir(const char *dir, const char *rel, const char *ext, const vocabulary_t *script_run) { + + struct dirent **namelist; + int n = scandir(dir, &namelist, NULL, alphasort); + if (n < 0) { + return; + } + + for (int i = 0; i < n; i++) { + + const char *fname = namelist[i]->d_name; + + if (strcmp(fname, ".") == 0 || strcmp(fname, "..") == 0) { + free(namelist[i]); + continue; + } + + char fullpath[VOCAB_MAX_PATH] = {0}; + int len = snprintf(fullpath, sizeof(fullpath), "%s%s", dir, fname); + if (len < 0 || (size_t)len >= sizeof(fullpath) - 1) { + free(namelist[i]); + continue; + } + + if (path_is_directory(fullpath)) { + fullpath[len] = PATHSEP[0]; + fullpath[len + 1] = '\0'; + + char subrel[VOCAB_MAX_PATH] = {0}; + len = snprintf(subrel, sizeof(subrel), "%s%s%s", rel, fname, PATHSEP); + if (len > 0 && (size_t)len < sizeof(subrel)) { + vocab_add_scripts_dir(fullpath, subrel, ext, script_run); + } + free(namelist[i]); + continue; + } + + if (str_endswith(fname, ext)) { + char name[MAX_PM3_INPUT_ARGS_LENGTH] = {0}; + len = snprintf(name, sizeof(name), "%s %s%s", script_run->name, rel, fname); + if (len > 0 && (size_t)len < sizeof(name)) { + vocabulary_t *entry = vocab_add(name); + if (entry != NULL) { + entry->depth = script_run->depth; + memcpy(entry->is_available, script_run->is_available, sizeof(entry->is_available)); + } + } + } + free(namelist[i]); + } + free(namelist); +} + +// Same search order as searchAndList() / "script list": +// dev tree next to the executable, user directory, installed share directory. +static void vocab_add_scripts(const char *pm3dir, const char *ext, const vocabulary_t *script_run) { + + const char *exec_path = get_my_executable_directory(); + const char *user_path = get_my_user_directory(); + + if (exec_path != NULL) { + char path[VOCAB_MAX_PATH] = {0}; + int n = snprintf(path, sizeof(path), "%s%s", exec_path, pm3dir); + if (n > 0 && (size_t)n < sizeof(path)) { + vocab_add_scripts_dir(path, "", ext, script_run); + } + } + + if (user_path != NULL) { + char path[VOCAB_MAX_PATH] = {0}; + int n = snprintf(path, sizeof(path), "%s%s%s", user_path, PM3_USER_DIRECTORY, pm3dir); + if (n > 0 && (size_t)n < sizeof(path)) { + vocab_add_scripts_dir(path, "", ext, script_run); + } + } + + if (exec_path != NULL) { + char path[VOCAB_MAX_PATH] = {0}; + int n = snprintf(path, sizeof(path), "%s%s%s", exec_path, PM3_SHARE_RELPATH, pm3dir); + if (n > 0 && (size_t)n < sizeof(path)) { + vocab_add_scripts_dir(path, "", ext, script_run); + } + } +} + +void pm3line_vocabulary_build(void) { + + pm3line_vocabulary_free(); + + // The walk goes through the Parse() of every category. Keep it silent: + // a few commands shown like categories (e.g. "reveng") run their own + // parser on the walk token and would complain about it. + uint8_t old_printAndLog = g_printAndLog; + g_printAndLog = 0; + walkCommandsRecursive(getTopLevelCommandTable(), vocab_visit_command, NULL); + g_printAndLog = old_printAndLog; + + // Script files complete as "script run ", with the availability of "script run". + // Take a copy: vocab_add() may realloc the array while scripts are being added. + vocabulary_t script_run = {0}; + for (size_t i = 0; i < s_count; i++) { + if (strcmp(s_vocab[i].name, "script run") == 0) { + script_run = s_vocab[i]; + break; + } + } + + if (script_run.name != NULL) { + vocab_add_scripts(LUA_SCRIPTS_SUBDIR, ".lua", &script_run); + vocab_add_scripts(CMD_SCRIPTS_SUBDIR, ".cmd", &script_run); +#ifdef HAVE_PYTHON + vocab_add_scripts(PYTHON_SCRIPTS_SUBDIR, ".py", &script_run); +#endif + } + + s_built = true; +} + +void pm3line_vocabulary_free(void) { + for (size_t i = 0; i < s_count; i++) { + free(s_vocab[i].name); + } + free(s_vocab); + s_vocab = NULL; + s_count = 0; + s_capacity = 0; + s_built = false; +} + +const vocabulary_t *pm3line_vocabulary_get(size_t *count) { + if (s_built == false) { + pm3line_vocabulary_build(); + } + if (count != NULL) { + *count = s_count; + } + return s_vocab; +} + +bool pm3line_vocabulary_is_available(const vocabulary_t *entry) { + if (entry == NULL) { + return false; + } + for (uint8_t i = 0; i < entry->depth; i++) { + if (entry->is_available[i] != NULL && entry->is_available[i]() == false) { + return false; + } + } + return true; +} diff --git a/client/src/pm3line_vocabulary.h b/client/src/pm3line_vocabulary.h index 6f98e05d4..f5dc55668 100644 --- a/client/src/pm3line_vocabulary.h +++ b/client/src/pm3line_vocabulary.h @@ -13,7 +13,8 @@ // // See LICENSE.txt for the text of the license. //----------------------------------------------------------------------------- -// readline auto complete utilities +// Line editor auto complete vocabulary, built at runtime from the live +// command tree so it can never drift from what "help" shows. //----------------------------------------------------------------------------- #ifndef PM3LINE_VOCABULARY_H__ @@ -24,1144 +25,36 @@ extern "C" { #endif #include +#include +#include +#include "cmdparser.h" // CMD_WALK_MAX_DEPTH typedef struct vocabulary_s { - bool offline; - const char *name; + // full command line, e.g. "hf mf dump" or "script run foo.lua" + char *name; + // IsAvailable predicates of the command and of every category on the way + // down to it, in tree order. All of them must hold for the command to be + // listed by "help", so the same rule is applied for completion. + uint8_t depth; + bool (*is_available[CMD_WALK_MAX_DEPTH])(void); } vocabulary_t; -const static vocabulary_t vocabulary[] = { - { 1, "help" }, - { 0, "auto" }, - { 1, "clear" }, - { 1, "hints" }, - { 1, "msleep" }, - { 1, "rem" }, - { 1, "quit" }, - { 1, "exit" }, - { 1, "prefs help" }, - { 1, "prefs show" }, - { 1, "prefs get barmode" }, - { 1, "prefs get client.debug" }, - { 1, "prefs get client.delay" }, - { 1, "prefs get client.timeout" }, - { 1, "prefs get hf.field.timeout_sec" }, - { 1, "prefs get color" }, - { 1, "prefs get savepaths" }, - { 1, "prefs get emoji" }, - { 1, "prefs get hints" }, - { 1, "prefs get output" }, - { 1, "prefs get plotsliders" }, - { 1, "prefs get mqtt" }, - { 1, "prefs set help" }, - { 1, "prefs set barmode" }, - { 1, "prefs set client.debug" }, - { 1, "prefs set client.delay" }, - { 1, "prefs set client.timeout" }, - { 1, "prefs set hf.field.timeout_sec" }, - { 1, "prefs set color" }, - { 1, "prefs set emoji" }, - { 1, "prefs set hints" }, - { 1, "prefs set savepaths" }, - { 1, "prefs set output" }, - { 1, "prefs set plotsliders" }, - { 1, "prefs set mqtt" }, - { 1, "analyse help" }, - { 1, "analyse lrc" }, - { 1, "analyse crc" }, - { 1, "analyse chksum" }, - { 1, "analyse dates" }, - { 1, "analyse lfsr" }, - { 1, "analyse a" }, - { 1, "analyse nuid" }, - { 1, "analyse demodbuff" }, - { 1, "analyse freq" }, - { 1, "analyse foo" }, - { 1, "analyse regex" }, - { 1, "analyse units" }, - { 1, "data help" }, - { 1, "data clear" }, - { 1, "data hide" }, - { 1, "data load" }, - { 1, "data num" }, - { 1, "data plot" }, - { 1, "data print" }, - { 1, "data save" }, - { 1, "data setdebugmode" }, - { 1, "data xor" }, - { 1, "data biphaserawdecode" }, - { 1, "data detectclock" }, - { 1, "data fsktonrz" }, - { 1, "data manrawdecode" }, - { 1, "data modulation" }, - { 1, "data rawdemod" }, - { 1, "data autodemod" }, - { 1, "data fft" }, - { 1, "data fitscore" }, - { 1, "data spectrum" }, - { 1, "data askedgedetect" }, - { 1, "data autocorr" }, - { 1, "data convertbitstream" }, - { 1, "data cthreshold" }, - { 1, "data dirthreshold" }, - { 1, "data decimate" }, - { 1, "data envelope" }, - { 1, "data grid" }, - { 1, "data getbitstream" }, - { 1, "data hpf" }, - { 1, "data iir" }, - { 1, "data ltrim" }, - { 1, "data mtrim" }, - { 1, "data norm" }, - { 1, "data rtrim" }, - { 1, "data setgraphmarkers" }, - { 1, "data shiftgraphzero" }, - { 1, "data timescale" }, - { 1, "data undecimate" }, - { 1, "data zerocrossings" }, - { 1, "data asn1" }, - { 1, "data atr" }, - { 0, "data bitsamples" }, - { 1, "data bmap" }, - { 1, "data crypto" }, - { 1, "data diff" }, - { 0, "data hexsamples" }, - { 0, "data samples" }, - { 1, "data qrcode" }, - { 0, "data gensignal" }, - { 0, "data test_ss8" }, - { 0, "data test_ss32" }, - { 0, "data test_ss32s" }, - { 1, "emv help" }, - { 1, "emv list" }, - { 1, "emv test" }, - { 0, "emv challenge" }, - { 0, "emv exec" }, - { 0, "emv genac" }, - { 0, "emv gpo" }, - { 0, "emv intauth" }, - { 0, "emv pse" }, - { 0, "emv reader" }, - { 0, "emv readrec" }, - { 0, "emv roca" }, - { 0, "emv scan" }, - { 0, "emv search" }, - { 0, "emv select" }, - { 0, "emv smart2nfc" }, - { 1, "hf help" }, - { 1, "hf list" }, - { 0, "hf plot" }, - { 0, "hf tune" }, - { 1, "hf search" }, - { 0, "hf sniff" }, - { 1, "hf 14a help" }, - { 1, "hf 14a list" }, - { 0, "hf 14a antifuzz" }, - { 0, "hf 14a config" }, - { 0, "hf 14a cuids" }, - { 0, "hf 14a info" }, - { 0, "hf 14a sim" }, - { 0, "hf 14a simaid" }, - { 0, "hf 14a sniff" }, - { 0, "hf 14a raw" }, - { 0, "hf 14a reader" }, - { 0, "hf 14a apdu" }, - { 0, "hf 14a apdufind" }, - { 0, "hf 14a chaining" }, - { 0, "hf 14a ndefformat" }, - { 0, "hf 14a ndefread" }, - { 0, "hf 14a ndefwrite" }, - { 1, "hf 14b help" }, - { 0, "hf 14b config" }, - { 1, "hf 14b list" }, - { 0, "hf 14b apdu" }, - { 0, "hf 14b dump" }, - { 0, "hf 14b info" }, - { 0, "hf 14b ndefread" }, - { 0, "hf 14b raw" }, - { 0, "hf 14b rdbl" }, - { 0, "hf 14b reader" }, - { 0, "hf 14b restore" }, - { 0, "hf 14b sim" }, - { 0, "hf 14b sniff" }, - { 0, "hf 14b wrbl" }, - { 0, "hf 14b tearoff" }, - { 1, "hf 14b view" }, - { 1, "hf 14b valid" }, - { 0, "hf 14b ctdump" }, - { 0, "hf 14b ctrdbl" }, - { 0, "hf 14b setuid" }, - { 1, "hf 15 help" }, - { 1, "hf 15 list" }, - { 1, "hf 15 demod" }, - { 0, "hf 15 dump" }, - { 0, "hf 15 info" }, - { 0, "hf 15 sniff" }, - { 0, "hf 15 raw" }, - { 0, "hf 15 rdbl" }, - { 0, "hf 15 rdmulti" }, - { 0, "hf 15 reader" }, - { 0, "hf 15 restore" }, - { 0, "hf 15 samples" }, - { 1, "hf 15 view" }, - { 0, "hf 15 wipe" }, - { 0, "hf 15 wrbl" }, - { 0, "hf 15 sim" }, - { 0, "hf 15 eload" }, - { 0, "hf 15 esave" }, - { 0, "hf 15 eview" }, - { 0, "hf 15 slixwritepwd" }, - { 0, "hf 15 slixeasdisable" }, - { 0, "hf 15 slixeasenable" }, - { 0, "hf 15 slixprivacydisable" }, - { 0, "hf 15 slixprivacyenable" }, - { 0, "hf 15 slixprotectpage" }, - { 0, "hf 15 passprotectafi" }, - { 0, "hf 15 passprotecteas" }, - { 0, "hf 15 findafi" }, - { 0, "hf 15 writeafi" }, - { 0, "hf 15 writedsfid" }, - { 0, "hf 15 csetuid" }, - { 0, "hf 15 cfinalize" }, - { 1, "hf aliro help" }, - { 1, "hf aliro list" }, - { 0, "hf aliro info" }, - { 0, "hf aliro read" }, - { 1, "hf calypso help" }, - { 0, "hf calypso info" }, - { 0, "hf calypso dump" }, - { 0, "hf calypso probecmdcompat" }, - { 1, "hf calypso list" }, - { 1, "hf cipurse help" }, - { 1, "hf cipurse test" }, - { 0, "hf cipurse auth" }, - { 0, "hf cipurse aread" }, - { 0, "hf cipurse awrite" }, - { 0, "hf cipurse create" }, - { 0, "hf cipurse delete" }, - { 0, "hf cipurse default" }, - { 0, "hf cipurse formatall" }, - { 0, "hf cipurse info" }, - { 0, "hf cipurse read" }, - { 0, "hf cipurse select" }, - { 0, "hf cipurse updkey" }, - { 0, "hf cipurse updakey" }, - { 0, "hf cipurse write" }, - { 1, "hf epa help" }, - { 0, "hf epa cnonces" }, - { 0, "hf epa replay" }, - { 0, "hf epa sim" }, - { 1, "hf emrtd help" }, - { 0, "hf emrtd dump" }, - { 1, "hf emrtd info" }, - { 1, "hf emrtd list" }, - { 1, "hf emrtd test" }, - { 1, "hf felica help" }, - { 1, "hf felica list" }, - { 0, "hf felica info" }, - { 0, "hf felica raw" }, - { 0, "hf felica rdbl" }, - { 0, "hf felica reader" }, - { 0, "hf felica sniff" }, - { 0, "hf felica wrbl" }, - { 0, "hf felica seacauth1" }, - { 0, "hf felica dump" }, - { 0, "hf felica discnodes" }, - { 0, "hf felica sim" }, - { 0, "hf felica rqservice" }, - { 0, "hf felica rqresponse" }, - { 0, "hf felica scsvcode" }, - { 0, "hf felica rqsyscode" }, - { 0, "hf felica auth1" }, - { 0, "hf felica auth2" }, - { 0, "hf felica rqspecver" }, - { 0, "hf felica resetmode" }, - { 0, "hf felica litesim" }, - { 0, "hf felica liteauth" }, - { 0, "hf felica litedump" }, - { 1, "hf fido help" }, - { 1, "hf fido list" }, - { 0, "hf fido info" }, - { 0, "hf fido reg" }, - { 0, "hf fido auth" }, - { 0, "hf fido make" }, - { 0, "hf fido assert" }, - { 1, "hf fmcos help" }, - { 0, "hf fmcos info" }, - { 0, "hf fmcos select" }, - { 0, "hf fmcos erase" }, - { 0, "hf fmcos createdir" }, - { 0, "hf fmcos createfile" }, - { 0, "hf fmcos createkeyfile" }, - { 0, "hf fmcos readbinary" }, - { 0, "hf fmcos readrecord" }, - { 0, "hf fmcos writebinary" }, - { 0, "hf fmcos writerecord" }, - { 0, "hf fmcos append" }, - { 0, "hf fmcos authexternal" }, - { 0, "hf fmcos authinternal" }, - { 0, "hf fmcos key" }, - { 0, "hf fmcos pinverify" }, - { 0, "hf fmcos pinchange" }, - { 0, "hf fmcos pinreset" }, - { 0, "hf fmcos pinunblock" }, - { 0, "hf fmcos balance" }, - { 0, "hf fmcos credit" }, - { 0, "hf fmcos purchase" }, - { 0, "hf fmcos overdraft" }, - { 0, "hf fmcos history" }, - { 0, "hf fmcos block" }, - { 0, "hf fmcos unblock" }, - { 0, "hf fmcos tidsetcard" }, - { 0, "hf fmcos tidsetuid" }, - { 0, "hf fmcos tidsetauth" }, - { 0, "hf fmcos tiderase" }, - { 0, "hf fmcos tidprovision" }, - { 0, "hf fmcos tidcreatedf" }, - { 0, "hf fmcos tidcreatebin" }, - { 0, "hf fmcos tidcreaterec" }, - { 1, "hf fudan help" }, - { 0, "hf fudan reader" }, - { 0, "hf fudan dump" }, - { 0, "hf fudan rdbl" }, - { 1, "hf fudan view" }, - { 0, "hf fudan wrbl" }, - { 1, "hf gallagher help" }, - { 1, "hf gallagher test" }, - { 0, "hf gallagher clone" }, - { 0, "hf gallagher delete" }, - { 1, "hf gallagher diversifykey" }, - { 1, "hf gallagher decode" }, - { 1, "hf gallagher encode" }, - { 0, "hf gallagher reader" }, - { 1, "hf gst help" }, - { 1, "hf gst list" }, - { 1, "hf gst test" }, - { 0, "hf gst info" }, - { 0, "hf gst read" }, - { 1, "hf secc help" }, - { 0, "hf secc info" }, - { 0, "hf secc sim" }, - { 0, "hf secc sniff" }, - { 1, "hf iclass help" }, - { 1, "hf iclass list" }, - { 0, "hf iclass dump" }, - { 0, "hf iclass info" }, - { 0, "hf iclass rdbl" }, - { 0, "hf iclass reader" }, - { 0, "hf iclass restore" }, - { 0, "hf iclass sniff" }, - { 1, "hf iclass view" }, - { 0, "hf iclass wrbl" }, - { 0, "hf iclass creditepurse" }, - { 0, "hf iclass tear" }, - { 0, "hf iclass liberate" }, - { 0, "hf iclass chk" }, - { 1, "hf iclass loclass" }, - { 1, "hf iclass lookup" }, - { 0, "hf iclass legrec" }, - { 1, "hf iclass legbrute" }, - { 1, "hf iclass unhash" }, - { 0, "hf iclass blacktears" }, - { 0, "hf iclass sim" }, - { 0, "hf iclass tagsim" }, - { 0, "hf iclass eload" }, - { 0, "hf iclass esave" }, - { 0, "hf iclass esetblk" }, - { 0, "hf iclass eview" }, - { 0, "hf iclass configcard" }, - { 1, "hf iclass calcnewkey" }, - { 1, "hf iclass encode" }, - { 1, "hf iclass encrypt" }, - { 1, "hf iclass decrypt" }, - { 1, "hf iclass managekeys" }, - { 1, "hf iclass permutekey" }, - { 0, "hf iclass sam" }, - { 1, "hf ict help" }, - { 0, "hf ict credential" }, - { 0, "hf ict info" }, - { 1, "hf ict list" }, - { 1, "hf ict reader" }, - { 1, "hf jooki help" }, - { 0, "hf jooki clone" }, - { 1, "hf jooki decode" }, - { 1, "hf jooki encode" }, - { 0, "hf jooki sim" }, - { 1, "hf ksx6924 help" }, - { 0, "hf ksx6924 select" }, - { 0, "hf ksx6924 info" }, - { 0, "hf ksx6924 balance" }, - { 0, "hf ksx6924 init" }, - { 0, "hf ksx6924 prec" }, - { 1, "hf legic help" }, - { 0, "hf legic dump" }, - { 0, "hf legic info" }, - { 1, "hf legic list" }, - { 0, "hf legic rdbl" }, - { 0, "hf legic reader" }, - { 0, "hf legic restore" }, - { 0, "hf legic clone" }, - { 0, "hf legic migrate" }, - { 0, "hf legic wipe" }, - { 0, "hf legic wrbl" }, - { 0, "hf legic sim" }, - { 0, "hf legic eload" }, - { 0, "hf legic esave" }, - { 0, "hf legic eview" }, - { 0, "hf legic einfo" }, - { 1, "hf legic crc" }, - { 1, "hf legic view" }, - { 1, "hf lto help" }, - { 0, "hf lto dump" }, - { 0, "hf lto info" }, - { 1, "hf lto list" }, - { 0, "hf lto rdbl" }, - { 0, "hf lto reader" }, - { 0, "hf lto restore" }, - { 0, "hf lto wrbl" }, - { 1, "hf mf help" }, - { 1, "hf mf list" }, - { 0, "hf mf darkside" }, - { 0, "hf mf nested" }, - { 1, "hf mf hardnested" }, - { 0, "hf mf staticnested" }, - { 0, "hf mf sen" }, - { 0, "hf mf brute" }, - { 0, "hf mf autopwn" }, - { 0, "hf mf nack" }, - { 0, "hf mf chk" }, - { 0, "hf mf fchk" }, - { 1, "hf mf decrypt" }, - { 0, "hf mf supercard" }, - { 1, "hf mf keygen" }, - { 0, "hf mf auth4" }, - { 1, "hf mf acl" }, - { 0, "hf mf dump" }, - { 0, "hf mf info" }, - { 0, "hf mf isen" }, - { 1, "hf mf mad" }, - { 0, "hf mf madread" }, - { 0, "hf mf madwrite" }, - { 0, "hf mf madverify" }, - { 0, "hf mf personalize" }, - { 0, "hf mf rdbl" }, - { 0, "hf mf rdsc" }, - { 0, "hf mf restore" }, - { 0, "hf mf setmod" }, - { 1, "hf mf value" }, - { 1, "hf mf view" }, - { 0, "hf mf wipe" }, - { 0, "hf mf wrbl" }, - { 0, "hf mf sim" }, - { 0, "hf mf ecfill" }, - { 0, "hf mf eclr" }, - { 0, "hf mf egetblk" }, - { 0, "hf mf egetsc" }, - { 0, "hf mf ekeyprn" }, - { 0, "hf mf eload" }, - { 0, "hf mf esave" }, - { 0, "hf mf esetblk" }, - { 0, "hf mf eview" }, - { 0, "hf mf cgetblk" }, - { 0, "hf mf cgetsc" }, - { 0, "hf mf cload" }, - { 0, "hf mf csave" }, - { 0, "hf mf csetblk" }, - { 0, "hf mf csetuid" }, - { 0, "hf mf cview" }, - { 0, "hf mf cwipe" }, - { 0, "hf mf gen3uid" }, - { 0, "hf mf gen3blk" }, - { 0, "hf mf gen3freeze" }, - { 1, "hf mf ginfo" }, - { 0, "hf mf ggetblk" }, - { 0, "hf mf gload" }, - { 0, "hf mf gsave" }, - { 0, "hf mf gsetblk" }, - { 0, "hf mf gview" }, - { 0, "hf mf gchpwd" }, - { 0, "hf mf gdmgetcfg" }, - { 0, "hf mf gdmsetcfg" }, - { 1, "hf mf gdmparsecfg" }, - { 0, "hf mf gdmgetblk" }, - { 0, "hf mf gdmsetblk" }, - { 0, "hf mf gdmgethidblk" }, - { 0, "hf mf gdmsethidblk" }, - { 0, "hf mf gdmsetuid" }, - { 0, "hf mf gdmwipe" }, - { 0, "hf mf gdmsetsig" }, - { 0, "hf mf ndefformat" }, - { 0, "hf mf ndefread" }, - { 0, "hf mf ndefwrite" }, - { 0, "hf mf encodehid" }, - { 1, "hf mfp help" }, - { 1, "hf mfp list" }, - { 1, "hf mfp acl" }, - { 0, "hf mfp auth" }, - { 0, "hf mfp chk" }, - { 0, "hf mfp dump" }, - { 0, "hf mfp info" }, - { 0, "hf mfp mad" }, - { 0, "hf mfp madread" }, - { 0, "hf mfp madwrite" }, - { 0, "hf mfp madverify" }, - { 0, "hf mfp rdbl" }, - { 0, "hf mfp rdsc" }, - { 0, "hf mfp wrbl" }, - { 0, "hf mfp chkey" }, - { 0, "hf mfp chconf" }, - { 0, "hf mfp commitp" }, - { 0, "hf mfp initp" }, - { 0, "hf mfp wrp" }, - { 0, "hf mfp ndefformat" }, - { 0, "hf mfp ndefread" }, - { 0, "hf mfp ndefwrite" }, - { 1, "hf mfu help" }, - { 1, "hf mfu list" }, - { 1, "hf mfu keygen" }, - { 1, "hf mfu pwdgen" }, - { 0, "hf mfu otptear" }, - { 0, "hf mfu countertear" }, - { 0, "hf mfu cauth" }, - { 0, "hf mfu cchk" }, - { 1, "hf mfu desbrute" }, - { 0, "hf mfu aesauth" }, - { 0, "hf mfu aeschk" }, - { 0, "hf mfu aesgetuid" }, - { 0, "hf mfu setkey" }, - { 0, "hf mfu dump" }, - { 0, "hf mfu incr" }, - { 0, "hf mfu info" }, - { 0, "hf mfu ndefread" }, - { 0, "hf mfu ndefwrite" }, - { 0, "hf mfu rdbl" }, - { 0, "hf mfu restore" }, - { 0, "hf mfu tamper" }, - { 1, "hf mfu view" }, - { 0, "hf mfu wipe" }, - { 0, "hf mfu wrbl" }, - { 0, "hf mfu eload" }, - { 0, "hf mfu esave" }, - { 0, "hf mfu eview" }, - { 0, "hf mfu esetblk" }, - { 0, "hf mfu sim" }, - { 0, "hf mfu setuid" }, - { 0, "hf mfu amiibo" }, - { 1, "hf mfdes help" }, - { 1, "hf mfdes list" }, - { 0, "hf mfdes auth" }, - { 0, "hf mfdes chk" }, - { 0, "hf mfdes default" }, - { 0, "hf mfdes detect" }, - { 0, "hf mfdes formatpicc" }, - { 0, "hf mfdes freemem" }, - { 0, "hf mfdes getversion" }, - { 0, "hf mfdes getuid" }, - { 0, "hf mfdes pc" }, - { 0, "hf mfdes info" }, - { 0, "hf mfdes mad" }, - { 0, "hf mfdes setconfig" }, - { 0, "hf mfdes lsapp" }, - { 0, "hf mfdes getaids" }, - { 0, "hf mfdes getappnames" }, - { 0, "hf mfdes bruteaid" }, - { 0, "hf mfdes brutedamslot" }, - { 0, "hf mfdes createapp" }, - { 0, "hf mfdes createdelegateapp" }, - { 0, "hf mfdes getdelegateappinfo" }, - { 0, "hf mfdes deleteapp" }, - { 0, "hf mfdes selectapp" }, - { 0, "hf mfdes selectisofid" }, - { 0, "hf mfdes changekey" }, - { 0, "hf mfdes chkeysettings" }, - { 0, "hf mfdes getkeysettings" }, - { 0, "hf mfdes getkeyversions" }, - { 0, "hf mfdes bruteisofid" }, - { 0, "hf mfdes getfileids" }, - { 0, "hf mfdes getfileisoids" }, - { 0, "hf mfdes lsfiles" }, - { 0, "hf mfdes dump" }, - { 0, "hf mfdes createfile" }, - { 0, "hf mfdes createvaluefile" }, - { 0, "hf mfdes createrecordfile" }, - { 0, "hf mfdes createmacfile" }, - { 0, "hf mfdes deletefile" }, - { 0, "hf mfdes getfilesettings" }, - { 0, "hf mfdes chfilesettings" }, - { 0, "hf mfdes read" }, - { 0, "hf mfdes write" }, - { 0, "hf mfdes value" }, - { 0, "hf mfdes clearrecfile" }, - { 1, "hf mfdes makemfclicense" }, - { 0, "hf mfdes createmfcmapping" }, - { 0, "hf mfdes verifycert" }, - { 0, "hf mfdes intauth" }, - { 0, "hf mfdes vdesign" }, - { 1, "hf mfdes test" }, - { 1, "hf ntag424 help" }, - { 0, "hf ntag424 info" }, - { 1, "hf ntag424 view" }, - { 0, "hf ntag424 auth" }, - { 0, "hf ntag424 read" }, - { 0, "hf ntag424 write" }, - { 0, "hf ntag424 getfs" }, - { 0, "hf ntag424 changefs" }, - { 0, "hf ntag424 changekey" }, - { 1, "hf saflok help" }, - { 1, "hf saflok test" }, - { 0, "hf saflok cksum" }, - { 1, "hf saflok encode" }, - { 1, "hf saflok encrypt" }, - { 1, "hf saflok decode" }, - { 1, "hf saflok decrypt" }, - { 0, "hf saflok interrogate" }, - { 0, "hf saflok provision" }, - { 1, "hf saflok modify" }, - { 0, "hf saflok read" }, - { 1, "hf seos help" }, - { 1, "hf seos list" }, - { 0, "hf seos sam" }, - { 0, "hf seos info" }, - { 0, "hf seos pacs" }, - { 0, "hf seos write" }, - { 0, "hf seos adf" }, - { 0, "hf seos gdf" }, - { 0, "hf seos sim" }, - { 1, "hf seos managekeys" }, - { 1, "hf st25ta help" }, - { 0, "hf st25ta info" }, - { 1, "hf st25ta list" }, - { 1, "hf st25ta ndefread" }, - { 0, "hf st25ta protect" }, - { 0, "hf st25ta pwd" }, - { 0, "hf st25ta sim" }, - { 1, "hf tesla help" }, - { 0, "hf tesla info" }, - { 1, "hf tesla list" }, - { 1, "hf texkom help" }, - { 0, "hf texkom reader" }, - { 0, "hf texkom sim" }, - { 1, "hf thinfilm help" }, - { 0, "hf thinfilm info" }, - { 1, "hf thinfilm list" }, - { 0, "hf thinfilm sim" }, - { 1, "hf topaz help" }, - { 1, "hf topaz list" }, - { 0, "hf topaz dump" }, - { 0, "hf topaz info" }, - { 0, "hf topaz raw" }, - { 0, "hf topaz rdbl" }, - { 0, "hf topaz reader" }, - { 0, "hf topaz sim" }, - { 0, "hf topaz sniff" }, - { 1, "hf topaz view" }, - { 0, "hf topaz wrbl" }, - { 1, "hf vas help" }, - { 0, "hf vas info" }, - { 0, "hf vas reader" }, - { 1, "hf vas decrypt" }, - { 1, "hf waveshare help" }, - { 1, "hf waveshare load" }, - { 1, "hf xerox help" }, - { 1, "hf xerox list" }, - { 0, "hf xerox info" }, - { 0, "hf xerox dump" }, - { 0, "hf xerox reader" }, - { 1, "hf xerox view" }, - { 0, "hf xerox rdbl" }, - { 1, "hw help" }, - { 0, "hw detectreader" }, - { 0, "hw status" }, - { 0, "hw tearoff" }, - { 1, "hw timeout" }, - { 1, "hw version" }, - { 0, "hw break" }, - { 0, "hw bootloader" }, - { 1, "hw connect" }, - { 0, "hw dbg" }, - { 0, "hw fpga" }, - { 0, "hw fpgaoff" }, - { 0, "hw ant_pm5" }, - { 0, "hw qc_pm5" }, - { 0, "hw factorydata" }, - { 0, "hw lcd" }, - { 0, "hw lcdreset" }, - { 0, "hw ping" }, - { 0, "hw readmem" }, - { 0, "hw reset" }, - { 0, "hw setlfdivisor" }, - { 0, "hw sethfthresh" }, - { 0, "hw setmux" }, - { 0, "hw standalone" }, - { 0, "hw tia" }, - { 0, "hw bwmsetcap" }, - { 0, "hw bwmcharge" }, - { 0, "hw bwmautooff" }, - { 0, "hw bwmwifi" }, - { 0, "hw tune" }, - { 0, "hw decay" }, - { 1, "lf help" }, - { 0, "lf config" }, - { 0, "lf cmdread" }, - { 0, "lf read" }, - { 0, "lf relay" }, - { 1, "lf search" }, - { 0, "lf sim" }, - { 0, "lf simask" }, - { 0, "lf simfsk" }, - { 0, "lf simpsk" }, - { 0, "lf simbidir" }, - { 0, "lf sniff" }, - { 0, "lf tune" }, - { 1, "lf awid help" }, - { 0, "lf awid brute" }, - { 0, "lf awid clone" }, - { 1, "lf awid demod" }, - { 0, "lf awid reader" }, - { 0, "lf awid sim" }, - { 0, "lf awid watch" }, - { 1, "lf cotag help" }, - { 1, "lf cotag demod" }, - { 0, "lf cotag reader" }, - { 1, "lf destron help" }, - { 1, "lf destron demod" }, - { 0, "lf destron reader" }, - { 0, "lf destron clone" }, - { 0, "lf destron sim" }, - { 1, "lf em help" }, - { 1, "lf em 410x help" }, - { 1, "lf em 410x demod" }, - { 0, "lf em 410x reader" }, - { 0, "lf em 410x sim" }, - { 0, "lf em 410x brute" }, - { 0, "lf em 410x watch" }, - { 0, "lf em 410x spoof" }, - { 0, "lf em 410x clone" }, - { 1, "lf em 4x05 help" }, - { 0, "lf em 4x05 clonehelp" }, - { 0, "lf em 4x05 brute" }, - { 0, "lf em 4x05 chk" }, - { 1, "lf em 4x05 config" }, - { 1, "lf em 4x05 demod" }, - { 0, "lf em 4x05 dump" }, - { 0, "lf em 4x05 info" }, - { 0, "lf em 4x05 read" }, - { 1, "lf em 4x05 sniff" }, - { 0, "lf em 4x05 unlock" }, - { 1, "lf em 4x05 view" }, - { 0, "lf em 4x05 wipe" }, - { 0, "lf em 4x05 write" }, - { 1, "lf em 4x50 help" }, - { 0, "lf em 4x50 brute" }, - { 0, "lf em 4x50 chk" }, - { 0, "lf em 4x50 dump" }, - { 0, "lf em 4x50 info" }, - { 0, "lf em 4x50 login" }, - { 0, "lf em 4x50 rdbl" }, - { 0, "lf em 4x50 reader" }, - { 0, "lf em 4x50 restore" }, - { 1, "lf em 4x50 view" }, - { 0, "lf em 4x50 wipe" }, - { 0, "lf em 4x50 wrbl" }, - { 0, "lf em 4x50 wrpwd" }, - { 0, "lf em 4x50 eload" }, - { 0, "lf em 4x50 esave" }, - { 0, "lf em 4x50 eview" }, - { 0, "lf em 4x50 sim" }, - { 1, "lf em 4x70 help" }, - { 0, "lf em 4x70 brute" }, - { 0, "lf em 4x70 info" }, - { 0, "lf em 4x70 write" }, - { 0, "lf em 4x70 unlock" }, - { 0, "lf em 4x70 auth" }, - { 0, "lf em 4x70 setpin" }, - { 0, "lf em 4x70 setkey" }, - { 1, "lf em 4x70 calc" }, - { 1, "lf em 4x70 recover" }, - { 0, "lf em 4x70 autorecover" }, - { 1, "lf fdxb help" }, - { 1, "lf fdxb demod" }, - { 0, "lf fdxb reader" }, - { 0, "lf fdxb clone" }, - { 0, "lf fdxb sim" }, - { 1, "lf gallagher help" }, - { 1, "lf gallagher demod" }, - { 0, "lf gallagher reader" }, - { 0, "lf gallagher clone" }, - { 0, "lf gallagher sim" }, - { 1, "lf gproxii help" }, - { 1, "lf gproxii demod" }, - { 0, "lf gproxii reader" }, - { 0, "lf gproxii clone" }, - { 0, "lf gproxii sim" }, - { 1, "lf hid help" }, - { 1, "lf hid demod" }, - { 0, "lf hid reader" }, - { 0, "lf hid clone" }, - { 0, "lf hid sim" }, - { 0, "lf hid brute" }, - { 0, "lf hid watch" }, - { 1, "lf hitag help" }, - { 1, "lf hitag list" }, - { 0, "lf hitag info" }, - { 0, "lf hitag reader" }, - { 1, "lf hitag test" }, - { 0, "lf hitag dump" }, - { 0, "lf hitag read" }, - { 0, "lf hitag sniff" }, - { 1, "lf hitag view" }, - { 0, "lf hitag wrbl" }, - { 0, "lf hitag eload" }, - { 0, "lf hitag eview" }, - { 0, "lf hitag sim" }, - { 0, "lf hitag cc" }, - { 0, "lf hitag crack2" }, - { 0, "lf hitag chk" }, - { 1, "lf hitag lookup" }, - { 0, "lf hitag ta" }, - { 1, "lf hitag hts help" }, - { 1, "lf hitag hts list" }, - { 0, "lf hitag hts reader" }, - { 0, "lf hitag hts rdbl" }, - { 0, "lf hitag hts dump" }, - { 0, "lf hitag hts restore" }, - { 0, "lf hitag hts wrbl" }, - { 0, "lf hitag hts sim" }, - { 1, "lf hitag htu help" }, - { 1, "lf hitag htu list" }, - { 0, "lf hitag htu reader" }, - { 0, "lf hitag htu rdbl" }, - { 0, "lf hitag htu dump" }, - { 0, "lf hitag htu wrbl" }, - { 0, "lf hitag htu sim" }, - { 1, "lf idteck help" }, - { 1, "lf idteck demod" }, - { 0, "lf idteck reader" }, - { 0, "lf idteck clone" }, - { 0, "lf idteck sim" }, - { 1, "lf indala help" }, - { 0, "lf indala brute" }, - { 1, "lf indala demod" }, - { 1, "lf indala altdemod" }, - { 0, "lf indala reader" }, - { 0, "lf indala clone" }, - { 0, "lf indala sim" }, - { 1, "lf io help" }, - { 1, "lf io demod" }, - { 0, "lf io reader" }, - { 0, "lf io clone" }, - { 0, "lf io sim" }, - { 0, "lf io watch" }, - { 1, "lf jablotron help" }, - { 1, "lf jablotron demod" }, - { 0, "lf jablotron reader" }, - { 0, "lf jablotron clone" }, - { 0, "lf jablotron sim" }, - { 1, "lf keri help" }, - { 1, "lf keri demod" }, - { 0, "lf keri reader" }, - { 0, "lf keri clone" }, - { 0, "lf keri sim" }, - { 1, "lf motorola help" }, - { 1, "lf motorola demod" }, - { 0, "lf motorola reader" }, - { 0, "lf motorola clone" }, - { 0, "lf motorola sim" }, - { 1, "lf nedap help" }, - { 1, "lf nedap demod" }, - { 0, "lf nedap reader" }, - { 0, "lf nedap clone" }, - { 0, "lf nedap sim" }, - { 1, "lf nexwatch help" }, - { 1, "lf nexwatch demod" }, - { 0, "lf nexwatch reader" }, - { 0, "lf nexwatch clone" }, - { 0, "lf nexwatch sim" }, - { 1, "lf noralsy help" }, - { 1, "lf noralsy demod" }, - { 0, "lf noralsy reader" }, - { 0, "lf noralsy clone" }, - { 0, "lf noralsy sim" }, - { 1, "lf pac help" }, - { 1, "lf pac demod" }, - { 0, "lf pac reader" }, - { 0, "lf pac clone" }, - { 0, "lf pac sim" }, - { 1, "lf paradox help" }, - { 1, "lf paradox demod" }, - { 0, "lf paradox reader" }, - { 0, "lf paradox clone" }, - { 0, "lf paradox sim" }, - { 1, "lf pcf7931 help" }, - { 0, "lf pcf7931 reader" }, - { 0, "lf pcf7931 write" }, - { 1, "lf pcf7931 config" }, - { 1, "lf presco help" }, - { 1, "lf presco demod" }, - { 0, "lf presco reader" }, - { 0, "lf presco clone" }, - { 0, "lf presco sim" }, - { 1, "lf pyramid help" }, - { 1, "lf pyramid demod" }, - { 0, "lf pyramid reader" }, - { 0, "lf pyramid clone" }, - { 0, "lf pyramid sim" }, - { 1, "lf securakey help" }, - { 1, "lf securakey demod" }, - { 0, "lf securakey reader" }, - { 0, "lf securakey clone" }, - { 0, "lf securakey sim" }, - { 1, "lf ti help" }, - { 1, "lf ti demod" }, - { 0, "lf ti reader" }, - { 0, "lf ti write" }, - { 1, "lf t55xx help" }, - { 0, "lf t55xx clonehelp" }, - { 1, "lf t55xx config" }, - { 0, "lf t55xx dangerraw" }, - { 1, "lf t55xx detect" }, - { 0, "lf t55xx deviceconfig" }, - { 0, "lf t55xx dump" }, - { 1, "lf t55xx info" }, - { 0, "lf t55xx p1detect" }, - { 0, "lf t55xx read" }, - { 0, "lf t55xx resetread" }, - { 0, "lf t55xx restore" }, - { 1, "lf t55xx trace" }, - { 0, "lf t55xx wakeup" }, - { 1, "lf t55xx view" }, - { 0, "lf t55xx write" }, - { 0, "lf t55xx bruteforce" }, - { 0, "lf t55xx chk" }, - { 0, "lf t55xx protect" }, - { 0, "lf t55xx recoverpw" }, - { 1, "lf t55xx sniff" }, - { 0, "lf t55xx special" }, - { 0, "lf t55xx wipe" }, - { 1, "lf trovan help" }, - { 1, "lf trovan demod" }, - { 0, "lf trovan reader" }, - { 0, "lf trovan clone" }, - { 1, "lf viking help" }, - { 1, "lf viking demod" }, - { 0, "lf viking reader" }, - { 0, "lf viking clone" }, - { 0, "lf viking sim" }, - { 1, "lf visa2000 help" }, - { 1, "lf visa2000 demod" }, - { 0, "lf visa2000 reader" }, - { 0, "lf visa2000 clone" }, - { 0, "lf visa2000 sim" }, - { 1, "mad help" }, - { 0, "mad read" }, - { 0, "mad write" }, - { 0, "mad verify" }, - { 1, "mad decode" }, - { 1, "mad encode" }, - { 1, "mad test" }, - { 1, "mem help" }, - { 0, "mem baudrate" }, - { 0, "mem dump" }, - { 0, "mem info" }, - { 0, "mem load" }, - { 0, "mem wipe" }, - { 1, "mem spiffs help" }, - { 0, "mem spiffs test" }, - { 0, "mem spiffs copy" }, - { 0, "mem spiffs check" }, - { 0, "mem spiffs dump" }, - { 0, "mem spiffs info" }, - { 0, "mem spiffs mount" }, - { 0, "mem spiffs remove" }, - { 0, "mem spiffs rename" }, - { 0, "mem spiffs tree" }, - { 0, "mem spiffs unmount" }, - { 0, "mem spiffs upload" }, - { 0, "mem spiffs view" }, - { 0, "mem spiffs wipe" }, - { 1, "mqtt help" }, - { 1, "mqtt send" }, - { 1, "mqtt receive" }, - { 1, "nfc help" }, - { 1, "nfc decode" }, - { 1, "nfc encode" }, - { 0, "nfc type1 read" }, - { 1, "nfc type1 help" }, - { 0, "nfc type2 read" }, - { 0, "nfc type2 write" }, - { 1, "nfc type2 help" }, - { 0, "nfc type4a format" }, - { 0, "nfc type4a read" }, - { 0, "nfc type4a write" }, - { 0, "nfc type4a st25taread" }, - { 1, "nfc type4a help" }, - { 0, "nfc type4b read" }, - { 1, "nfc type4b help" }, - { 0, "nfc mf cformat" }, - { 0, "nfc mf cread" }, - { 0, "nfc mf cwrite" }, - { 0, "nfc mf pread" }, - { 1, "nfc mf help" }, - { 0, "nfc barcode read" }, - { 0, "nfc barcode sim" }, - { 1, "nfc barcode help" }, - { 1, "piv help" }, - { 0, "piv select" }, - { 0, "piv getdata" }, - { 0, "piv authsign" }, - { 0, "piv scan" }, - { 1, "piv list" }, - { 1, "smart help" }, - { 1, "smart list" }, - { 0, "smart brute" }, - { 0, "smart info" }, - { 1, "smart pcsc" }, - { 0, "smart pps" }, - { 0, "smart reader" }, - { 0, "smart raw" }, - { 1, "smart upgrade" }, - { 0, "smart setclock" }, - { 1, "script help" }, - { 1, "script list" }, - { 1, "script run" }, - { 1, "trace help" }, - { 1, "trace extract" }, - { 1, "trace list" }, - { 1, "trace load" }, - { 1, "trace save" }, - { 1, "usart help" }, - { 0, "usart btpin" }, - { 0, "usart btfactory" }, - { 0, "usart tx" }, - { 0, "usart rx" }, - { 0, "usart txrx" }, - { 0, "usart txhex" }, - { 0, "usart rxhex" }, - { 0, "usart config" }, - { 1, "wiegand help" }, - { 1, "wiegand list" }, - { 1, "wiegand encode" }, - { 1, "wiegand decode" }, - { 0, "script run amiibo_change_uid.py" }, - { 0, "script run dc34.py" }, - { 0, "script run des_talk.py" }, - { 0, "script run findbits.py" }, - { 0, "script run fm11rf08s_full.py" }, - { 0, "script run fm11rf08s_recovery.py" }, - { 0, "script run hf_mfu_uscuid.py" }, - { 0, "script run ice.py" }, - { 0, "script run intertic.py" }, - { 0, "script run mf_backdoor_dump.py" }, - { 0, "script run mfuev1_counter_reset.py" }, - { 0, "script run mfulaes_mask_recovery.py" }, - { 0, "script run mfulc_counterfeit_recovery.py" }, - { 0, "script run ntag22x_libsuncmac.py" }, - { 0, "script run ntag22x_suncmac_recovery.py" }, - { 0, "script run parity.py" }, - { 0, "script run paxton_convert.py" }, - { 0, "script run paxton_net.py" }, - { 0, "script run paxton_switch.py" }, - { 0, "script run pm3.py" }, - { 0, "script run pm3_eml2mfd.py" }, - { 0, "script run pm3_eml_mfd_test.py" }, - { 0, "script run pm3_help2json.py" }, - { 0, "script run pm3_help2list.py" }, - { 0, "script run pm3_mfd2eml.py" }, - { 0, "script run pm3_nfc2eml.py" }, - { 0, "script run pm3_resources.py" }, - { 0, "script run read_t-union.py" }, - { 0, "script run spi_flash_decode.py" }, - { 0, "script run theremin.py" }, - { 0, "script run xorcheck.py" }, - { 0, "script run data_hex_crc.lua" }, - { 0, "script run data_mf_accessdecode.lua" }, - { 0, "script run data_mf_bin2eml.lua" }, - { 0, "script run data_mf_bin2html.lua" }, - { 0, "script run data_mf_eml2bin.lua" }, - { 0, "script run data_mf_eml2html.lua" }, - { 0, "script run data_mfu_bin2eml.lua" }, - { 0, "script run example_cmdline.lua" }, - { 0, "script run example_parameters.lua" }, - { 0, "script run hf_14a_aztek.lua" }, - { 0, "script run hf_14a_i2crevive.lua" }, - { 0, "script run hf_14a_protectimus_nfc.lua" }, - { 0, "script run hf_14a_raw.lua" }, - { 0, "script run hf_14a_read_ltocm.lua" }, - { 0, "script run hf_14b_calypso.lua" }, - { 0, "script run hf_14b_mobib.lua" }, - { 0, "script run hf_15_magic.lua" }, - { 0, "script run hf_i2c_plus_2k_utils.lua" }, - { 0, "script run hf_legic.lua" }, - { 0, "script run hf_legic_buffer2card.lua" }, - { 0, "script run hf_legic_clone.lua" }, - { 0, "script run hf_mf_autopwn.lua" }, - { 0, "script run hf_mf_dump_luxeo.lua" }, - { 0, "script run hf_mf_em_util.lua" }, - { 0, "script run hf_mf_format.lua" }, - { 0, "script run hf_mf_gen3_writer.lua" }, - { 0, "script run hf_mf_keycheck.lua" }, - { 0, "script run hf_mf_magicrevive.lua" }, - { 0, "script run hf_mf_mini_dumpdecrypt.lua" }, - { 0, "script run hf_mf_sim_hid.lua" }, - { 0, "script run hf_mf_tnp3_clone.lua" }, - { 0, "script run hf_mf_tnp3_dump.lua" }, - { 0, "script run hf_mf_tnp3_sim.lua" }, - { 0, "script run hf_mf_uid_downgrade.lua" }, - { 0, "script run hf_mf_uidbruteforce.lua" }, - { 0, "script run hf_mf_uidkeycalc.lua" }, - { 0, "script run hf_mf_uidkeycalc_mizip.lua" }, - { 0, "script run hf_mf_ultimatecard.lua" }, - { 0, "script run hf_mf_uscuid_prog.lua" }, - { 0, "script run hf_mfp_raw.lua" }, - { 0, "script run hf_mfu_amiibo_restore.lua" }, - { 0, "script run hf_mfu_amiibo_sim.lua" }, - { 0, "script run hf_mfu_magicwrite.lua" }, - { 0, "script run hf_mfu_pwdgen_italy.lua" }, - { 0, "script run hf_mfu_setuid.lua" }, - { 0, "script run hf_mfu_ultra.lua" }, - { 0, "script run hf_ndef_dump.lua" }, - { 0, "script run hf_ntag_3d.lua" }, - { 0, "script run hf_ntag_bruteforce.lua" }, - { 0, "script run hf_ntag_dt.lua" }, - { 0, "script run init_rdv4.lua" }, - { 0, "script run lf_awid_bulkclone.lua" }, - { 0, "script run lf_electra.lua" }, - { 0, "script run lf_em4100_bulk.lua" }, - { 0, "script run lf_em4x05_kybercrystals.lua" }, - { 0, "script run lf_em_tearoff.lua" }, - { 0, "script run lf_em_tearoff_protect.lua" }, - { 0, "script run lf_hid_bulkclone.lua" }, - { 0, "script run lf_hid_bulkclone_v2.lua" }, - { 0, "script run lf_ht2_paxton.lua" }, - { 0, "script run lf_ident_json.lua" }, - { 0, "script run lf_ioprox_bulkclone.lua" }, - { 0, "script run lf_t55xx_chk.lua" }, - { 0, "script run lf_t55xx_chk_date.lua" }, - { 0, "script run lf_t55xx_fix.lua" }, - { 0, "script run lf_t55xx_multiwriter.lua" }, - { 0, "script run lf_t55xx_reset.lua" }, - { 0, "script run mem_readpwd.lua" }, - { 0, "script run mem_spiffs_readpwd.lua" }, - { 0, "script run mfc_hammerlite.lua" }, - { 0, "script run multi_bruteforce.lua" }, - { 0, "script run ntag_clean.lua" }, - { 0, "script run ntag_getsig.lua" }, - { 0, "script run ntag_hammertime.lua" }, - { 0, "script run data_tracetest.lua" }, - { 0, "script run hf_read.lua" }, - { 0, "script run lf_t55xx_defaultask.lua" }, - { 0, "script run lf_t55xx_defaultbi.lua" }, - { 0, "script run lf_t55xx_defaultfsk.lua" }, - { 0, "script run lf_t55xx_defaultpsk.lua" }, - { 0, "script run lf_t55xx_writetest.lua" }, - { 0, "script run example.cmd" }, - { 0, "script run rdv4_init_extflash.cmd" }, - { 0, "script run test_psk_clone.cmd" }, - {0, NULL} -}; +// (Re)build the vocabulary from the command tree and the script directories. +// Called automatically on first use. +void pm3line_vocabulary_build(void); + +// Release the vocabulary. +void pm3line_vocabulary_free(void); + +// Get the vocabulary, building it if needed. +// Returns the entries and stores their number in *count. +const vocabulary_t *pm3line_vocabulary_get(size_t *count); + +// Evaluate the availability predicates of an entry, right now. +bool pm3line_vocabulary_is_available(const vocabulary_t *entry); #ifdef __cplusplus } #endif -#endif +#endif // PM3LINE_VOCABULARY_H__ diff --git a/client/src/proxmark3.c b/client/src/proxmark3.c index 7d91cdbb2..767af6635 100644 --- a/client/src/proxmark3.c +++ b/client/src/proxmark3.c @@ -702,6 +702,7 @@ check_script: } CmdScriptCleanup(); + pm3line_cleanup(); } #ifndef LIBPM3