Add support for: proxmark3 -c "hw ping;hw version;hw ping"

This commit is contained in:
Philippe Teuwen 2019-04-27 00:30:44 +02:00
parent a60b2f24a8
commit d3cc0bb71c

View file

@ -62,6 +62,9 @@ main_loop(char *script_cmds_file, char *script_cmd, bool pm3_present) {
char *cmd = NULL; char *cmd = NULL;
bool execCommand = (script_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); bool stdinOnPipe = !isatty(STDIN_FILENO);
FILE *sf = NULL; FILE *sf = NULL;
char script_cmd_buf[256] = {0x00}; // iceman, needs lua script the same file_path_buffer as the rest 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 { } else {
// If there is a script command // If there is a script command
if (execCommand) { if (execCommand) {
if ((cmd = strmcopy(script_cmd)) != NULL) if ((cmd = strmcopy(script_cmd)) != NULL)
PrintAndLogEx(NORMAL, PROXPROMPT"%s", cmd); PrintAndLogEx(NORMAL, PROXPROMPT"%s", cmd);
uint16_t len = strlen(script_cmd) + 1;
execCommand = false; script_cmd += len;
if (script_cmd_len == len - 1)
execCommand = false;
script_cmd_len -= len;
} else { } else {
// exit after exec command // exit after exec command
if (script_cmd) if (script_cmd)