mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 13:53:55 -07:00
accept multiple commands on stdin
This commit is contained in:
parent
a592b349cb
commit
836e0fa206
2 changed files with 13 additions and 8 deletions
|
@ -309,7 +309,7 @@ check_script:
|
||||||
} else {
|
} else {
|
||||||
// If there is a script command
|
// If there is a script command
|
||||||
if (execCommand) {
|
if (execCommand) {
|
||||||
prompt_ctx = PROXPROMPT_CTX_SCRIPTCMD;
|
prompt_ctx = stdinOnPipe ? PROXPROMPT_CTX_STDIN : PROXPROMPT_CTX_SCRIPTCMD;
|
||||||
|
|
||||||
cmd = str_dup(script_cmd);
|
cmd = str_dup(script_cmd);
|
||||||
if (cmd != NULL)
|
if (cmd != NULL)
|
||||||
|
@ -329,8 +329,6 @@ check_script:
|
||||||
|
|
||||||
// if there is a pipe from stdin
|
// if there is a pipe from stdin
|
||||||
if (stdinOnPipe) {
|
if (stdinOnPipe) {
|
||||||
prompt_ctx = PROXPROMPT_CTX_STDIN;
|
|
||||||
|
|
||||||
// clear array
|
// clear array
|
||||||
memset(script_cmd_buf, 0, sizeof(script_cmd_buf));
|
memset(script_cmd_buf, 0, sizeof(script_cmd_buf));
|
||||||
// get
|
// get
|
||||||
|
@ -338,13 +336,14 @@ check_script:
|
||||||
PrintAndLogEx(ERR, "STDIN unexpected end, exit...");
|
PrintAndLogEx(ERR, "STDIN unexpected end, exit...");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
execCommand = true;
|
||||||
|
stayInCommandLoop = true;
|
||||||
|
script_cmd = script_cmd_buf;
|
||||||
|
script_cmd_len = strlen(script_cmd);
|
||||||
|
strcreplace(script_cmd, script_cmd_len, ';', '\0');
|
||||||
// remove linebreaks
|
// remove linebreaks
|
||||||
strcleanrn(script_cmd_buf, sizeof(script_cmd_buf));
|
strcleanrn(script_cmd_buf, sizeof(script_cmd_buf));
|
||||||
|
goto check_script;
|
||||||
cmd = str_dup(script_cmd_buf);
|
|
||||||
if (cmd != NULL)
|
|
||||||
printprompt = true;
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
#ifdef HAVE_READLINE
|
#ifdef HAVE_READLINE
|
||||||
rl_event_hook = check_comm;
|
rl_event_hook = check_comm;
|
||||||
|
|
|
@ -351,6 +351,12 @@ while true; do
|
||||||
if ! CheckExecute "proxmark help text ISO7816" "$CLIENTBIN -t 2>&1" "ISO7816"; then break; fi
|
if ! CheckExecute "proxmark help text ISO7816" "$CLIENTBIN -t 2>&1" "ISO7816"; then break; fi
|
||||||
if ! CheckExecute "proxmark help text hardnested" "$CLIENTBIN -t 2>&1" "hardnested"; then break; fi
|
if ! CheckExecute "proxmark help text hardnested" "$CLIENTBIN -t 2>&1" "hardnested"; then break; fi
|
||||||
if ! CheckExecute "proxmark full help dump" "$CLIENTBIN --fulltext 2>&1" "Full help dump done"; then break; fi
|
if ! CheckExecute "proxmark full help dump" "$CLIENTBIN --fulltext 2>&1" "Full help dump done"; then break; fi
|
||||||
|
if ! CheckExecute "proxmark multi cmds 1/2" "$CLIENTBIN -c 'rem foo;rem bar'" "remark: foo"; then break; fi
|
||||||
|
if ! CheckExecute "proxmark multi cmds 2/2" "$CLIENTBIN -c 'rem foo;rem bar'" "remark: bar"; then break; fi
|
||||||
|
if ! CheckExecute "proxmark multi stdin 1/4" "echo 'rem foo;rem bar;quit' |$CLIENTBIN" "remark: foo"; then break; fi
|
||||||
|
if ! CheckExecute "proxmark multi stdin 2/4" "echo 'rem foo;rem bar;quit' |$CLIENTBIN" "remark: bar"; then break; fi
|
||||||
|
if ! CheckExecute "proxmark multi stdin 3/4" "echo -e 'rem foo\nrem bar;quit' |$CLIENTBIN" "remark: foo"; then break; fi
|
||||||
|
if ! CheckExecute "proxmark multi stdin 4/4" "echo -e 'rem foo\nrem bar;quit' |$CLIENTBIN" "remark: bar"; then break; fi
|
||||||
|
|
||||||
echo -e "\n${C_BLUE}Testing data manipulation:${C_NC}"
|
echo -e "\n${C_BLUE}Testing data manipulation:${C_NC}"
|
||||||
if ! CheckExecute "reveng readline test" "$CLIENTBIN -c 'reveng -h;reveng -D'" "CRC-64/GO-ISO"; then break; fi
|
if ! CheckExecute "reveng readline test" "$CLIENTBIN -c 'reveng -h;reveng -D'" "CRC-64/GO-ISO"; then break; fi
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue