- DUMPHELP("help");
- DUMPHELP("data help");
- DUMPHELP("hf help");
- DUMPHELP("hf 14a help");
- DUMPHELP("hf 14b help");
- DUMPHELP("hf 15 help");
- DUMPHELP("hf epa help");
- DUMPHELP("hf legic help");
- DUMPHELP("hf iclass help");
- DUMPHELP("hf mf help");
- DUMPHELP("hw help");
- DUMPHELP("lf help");
- DUMPHELP("lf em4x help");
- DUMPHELP("lf hid help");
- DUMPHELP("lf ti help");
- DUMPHELP("lf hitag help");
- DUMPHELP("lf pcf7931 help");
- DUMPHELP("lf t55xx help");
+ command_t *cmds = getTopLevelCommandTable();
+ dumpCommandsRecursive(cmds, markdown);
+}
+
+static char *my_executable_path = NULL;
+static char *my_executable_directory = NULL;
+
+const char *get_my_executable_path(void)
+{
+ return my_executable_path;
+}
+
+const char *get_my_executable_directory(void)
+{
+ return my_executable_directory;
+}
+
+static void set_my_executable_path(void)
+{
+ int path_length = wai_getExecutablePath(NULL, 0, NULL);
+ if (path_length != -1) {
+ my_executable_path = (char*)malloc(path_length + 1);
+ int dirname_length = 0;
+ if (wai_getExecutablePath(my_executable_path, path_length, &dirname_length) != -1) {
+ my_executable_path[path_length] = '\0';
+ my_executable_directory = (char *)malloc(dirname_length + 2);
+ strncpy(my_executable_directory, my_executable_path, dirname_length+1);
+ my_executable_directory[dirname_length+1] = '\0';
+ }
+ }
+}
+
+static void show_help(bool showFullHelp, char *command_line){
+ printf("syntax: %s <port> [-h|-help|-m|-f|-flush|-w|-wait|-c|-command|-l|-lua] [cmd_script_file_name] [command][lua_script_name]\n", command_line);
+ printf("\texample: %s "SERIAL_PORT_H"\n\n", command_line);
+
+ if (showFullHelp){
+ printf("help: <-h|-help> Dump all interactive command's help at once.\n");
+ printf("\t%s -h\n\n", command_line);
+ printf("markdown: <-m> Dump all interactive help at once in markdown syntax\n");
+ printf("\t%s -m\n\n", command_line);
+ printf("flush: <-f|-flush> Output will be flushed after every print.\n");
+ printf("\t%s -f\n\n", command_line);
+ printf("wait: <-w|-wait> 20sec waiting the serial port to appear in the OS\n");
+ printf("\t%s "SERIAL_PORT_H" -w\n\n", command_line);
+ printf("script: A script file with one proxmark3 command per line.\n\n");
+ printf("command: <-c|-command> Execute one proxmark3 command.\n");
+ printf("\t%s "SERIAL_PORT_H" -c \"hf mf chk 1* ?\"\n", command_line);
+ printf("\t%s "SERIAL_PORT_H" -command \"hf mf nested 1 *\"\n\n", command_line);
+ printf("lua: <-l|-lua> Execute lua script.\n");
+ printf("\t%s "SERIAL_PORT_H" -l hf_read\n\n", command_line);
+ }