@@ -716,9 +716,9 @@ static void show_help(bool showFullHelp, char *exec_name) {
716716
717717 PrintAndLogEx (NORMAL , "\nsyntax: %s [-h|-t|-m|--fulltext]" , exec_name );
718718#ifdef HAVE_PYTHON
719- PrintAndLogEx (NORMAL , " %s [[-p] <port>] [-b] [-w] [-f] [-c <command>]|[-l <lua_script_file>]|[-y <python_script_file>]|[-s <cmd_script_file>] [-i] [-d <0|1|2> ]" , exec_name );
719+ PrintAndLogEx (NORMAL , " %s [[-p] <port>] [-b] [-w] [-f] [-d <0|1|2>] [--incognito] [--ncpu <num_cores>] [-c \" <command>\" ]|[-l <lua_script_file>]|[-y <python_script_file>]|[-s <cmd_script_file>] [-i] [-- <arg0> <arg1>... ]" , exec_name );
720720#else // HAVE_PYTHON
721- PrintAndLogEx (NORMAL , " %s [[-p] <port>] [-b] [-w] [-f] [-c <command>]|[-l <lua_script_file>]|[-s <cmd_script_file>] [-i] [-d <0|1|2> ]" , exec_name );
721+ PrintAndLogEx (NORMAL , " %s [[-p] <port>] [-b] [-w] [-f] [-d <0|1|2>] [--incognito] [--ncpu <num_cores>] [-c \" <command>\" ]|[-l <lua_script_file>]|[-s <cmd_script_file>] [-i] [-- <arg0> <arg1>... ]" , exec_name );
722722#endif // HAVE_PYTHON
723723 PrintAndLogEx (NORMAL , " %s [-p] <port> --flash [--unlock-bootloader] [--image <imagefile>]+ [-w] [-f] [-d <0|1|2>]" , exec_name );
724724
@@ -736,16 +736,17 @@ static void show_help(bool showFullHelp, char *exec_name) {
736736 PrintAndLogEx (NORMAL , " --fulltext dump all interactive command's help at once" );
737737 PrintAndLogEx (NORMAL , " -m/--markdown dump all interactive command list at once in markdown syntax" );
738738 PrintAndLogEx (NORMAL , " -b/--baud serial port speed (only needed for physical UART, not for USB-CDC or BT)" );
739- PrintAndLogEx (NORMAL , " -c/--command <command> execute one Proxmark3 command (or several separated by ';')." );
739+ PrintAndLogEx (NORMAL , " --incognito do not use history, prefs file nor log files" );
740+ PrintAndLogEx (NORMAL , " --ncpu <num_cores> override number of CPU cores" );
741+ PrintAndLogEx (NORMAL , " -c/--command \"<command>\" execute one Proxmark3 command (or several separated by ';')." );
740742 PrintAndLogEx (NORMAL , " -l/--lua <lua_script_file> execute Lua script." );
741743#ifdef HAVE_PYTHON
742744 // Technically, --lua and --py are identical and interexchangeable
743745 PrintAndLogEx (NORMAL , " -y/--py <python_script_file> execute Python script." );
744746#endif // HAVE_PYTHON
745747 PrintAndLogEx (NORMAL , " -s/--script-file <cmd_script_file> script file with one Proxmark3 command per line" );
746748 PrintAndLogEx (NORMAL , " -i/--interactive enter interactive mode after executing the script or the command" );
747- PrintAndLogEx (NORMAL , " --incognito do not use history, prefs file nor log files" );
748- PrintAndLogEx (NORMAL , " --ncpu <num_cores> override number of CPU cores" );
749+ PrintAndLogEx (NORMAL , " -- <arg0> <arg1>... all args following -- are passed to the client command line" );
749750 PrintAndLogEx (NORMAL , "\nOptions in flasher mode:" );
750751 PrintAndLogEx (NORMAL , " --flash flash Proxmark3, requires at least one --image" );
751752 PrintAndLogEx (NORMAL , " --reboot-to-bootloader reboot Proxmark3 into bootloader mode" );
@@ -1230,6 +1231,30 @@ int main(int argc, char *argv[]) {
12301231 continue ;
12311232 }
12321233#endif // HAVE_PYTHON
1234+ // append all following args to script_cmd
1235+ if (strcmp (argv [i ], "--" ) == 0 ) {
1236+ bool script_cmd_on_heap = false;
1237+ for (++ i ; i < argc ; i ++ ) {
1238+ int extra_len = strlen (argv [i ]) + 1 ;
1239+ int old_len = script_cmd ? strlen (script_cmd ) : 0 ;
1240+ char * new_cmd = (char * ) calloc (old_len + extra_len + 1 , sizeof (uint8_t ));
1241+ if (new_cmd == NULL ) {
1242+ PrintAndLogEx (WARNING , "Failed to allocate memory" );
1243+ return 1 ;
1244+ }
1245+ if (script_cmd ) {
1246+ strcpy (new_cmd , script_cmd );
1247+ strcat (new_cmd , " " );
1248+ if (script_cmd_on_heap ) {
1249+ free (script_cmd );
1250+ }
1251+ }
1252+ strcat (new_cmd , argv [i ]);
1253+ script_cmd = new_cmd ;
1254+ script_cmd_on_heap = true;
1255+ }
1256+ continue ;
1257+ }
12331258 // go to interactive instead of quitting after a script/command
12341259 if (strcmp (argv [i ], "-i" ) == 0 || strcmp (argv [i ], "--interactive" ) == 0 ) {
12351260 stayInCommandLoop = true;
0 commit comments