From d3cc0bb71c5f4f270df78116bfedaaab10d5fc03 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Sat, 27 Apr 2019 00:30:44 +0200 Subject: [PATCH] Add support for: proxmark3 -c "hw ping;hw version;hw ping" --- client/proxmark3.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/client/proxmark3.c b/client/proxmark3.c index 0ada54e78..f1cf3a056 100644 --- a/client/proxmark3.c +++ b/client/proxmark3.c @@ -62,6 +62,9 @@ main_loop(char *script_cmds_file, char *script_cmd, bool pm3_present) { char *cmd = NULL; bool execCommand = (script_cmd != NULL); + uint16_t script_cmd_len = strlen(script_cmd); + if (execCommand) + strcreplace(script_cmd, script_cmd_len, ';', '\0'); bool stdinOnPipe = !isatty(STDIN_FILENO); FILE *sf = NULL; char script_cmd_buf[256] = {0x00}; // iceman, needs lua script the same file_path_buffer as the rest @@ -134,11 +137,13 @@ main_loop(char *script_cmds_file, char *script_cmd, bool pm3_present) { } else { // If there is a script command if (execCommand) { - if ((cmd = strmcopy(script_cmd)) != NULL) PrintAndLogEx(NORMAL, PROXPROMPT"%s", cmd); - - execCommand = false; + uint16_t len = strlen(script_cmd) + 1; + script_cmd += len; + if (script_cmd_len == len - 1) + execCommand = false; + script_cmd_len -= len; } else { // exit after exec command if (script_cmd)