SSH/SFTP Plugin - Macros


# EXECUTE_SSH $({command_content}) ON {target} AS {result}

What ?

This macro will execute an inline command on a SSH server

Underlying instructions :

DEFINE $({command_content}) AS __command{%%rand1}
CONVERT __command{%%rand1} TO query.shell AS __commandLine{%%rand2}
EXECUTE execute WITH __commandLine{%%rand2} ON {target} AS {result}
ASSERT {result} IS success

> Input :

  • {command_content} : It corresponds to the text of the shell command to execute.
  • {target} : The name (in the context) of the SSH server to use. (ssh.target type target).

> Output :

  • {result} : The name of the resource which references the result of the command.(result.shell type resource).

Example :

# EXECUTE_SSH $(echo “hello world”) ON ssh-server AS result


# EXECUTE_SSH $({command_content}) ON {target} AS {result} WITHIN {timeout} ms

What ?

This macro will execute an inline command on a SSH server.

Underlying instructions :

DEFINE $({command_content}) AS __command{%%rand1}
CONVERT __command{%%rand1} TO query.shell AS __commandLine{%%rand2}
EXECUTE execute WITH __commandLine{%%rand2} ON {target} USING $(timeout:{timeout}) AS {result}
ASSERT {result} IS success

> Input :

  • {target} : The name (in the context) of the SSH server to use (ssh.target type target).
  • {command_content} : It corresponds to the text of the shell command to execute.
  • {timeout} : Maximal time authorized for the command execution (in milliseconds).

> Output :

  • {result} : The name of the resource which references the result of the command(result.shell type resource).

Example :

# EXECUTE_SSH $(echo “hello world”) ON ssh-server AS result WITHIN 15000 ms


# EXECUTE_SSH_SCRIPT {script} ON {target} AS {result}

What ?

This macro will execute a shell script on a SSH server.

Underlying instructions :

LOAD {script} AS __{%%r1}.file
CONVERT __{%%r1}.file TO file(param.relativedate) AS __{%%r2}.file
CONVERT __{%%r2}.file TO query.shell AS __{%%r3}.script
EXECUTE execute WITH __{%%r3}.script ON {target} AS {result}
ASSERT {result} IS success

> Input :

  • {target} : The name (in the context) of the SSH server to use (ssh.target type target).
  • {script} : It corresponds to the path of the shell script to execute.

> Output :

  • {result} : The name of the resource which references the result of the command (result.shell type resource).

Example :

# EXECUTE_SSH_SCRIPT shell/shell-script.txt ON ssh-server AS result


# EXECUTE_SSH_SCRIPT {script} ON {target} AS {result} WITHIN {timeout} ms

What ?

This macro will execute a shell script on a SSH server.

Underlying instructions :

LOAD {script} AS __{%%r1}.file
CONVERT __{%%r1}.file TO file(param.relativedate) AS __{%%r2}.file
CONVERT __{%%r2}.file TO query.shell AS __{%%r3}.script
EXECUTE execute WITH __{%%r3}.script ON {target} USING $(timeout:{timeout}) AS {result}
ASSERT {result} IS success

> Input :

  • {target} : The name (in the context) of the SSH server to use (ssh.target type target).
  • {script} : It corresponds to the path of the shell script to execute.
  • {timeout} : Maximal time authorized for the command execution (in milliseconds).

> Output :

  • {result} : The name of the resource which references the result of the command(result.shell type resource).

Example :

# EXECUTE_SSH_SCRIPT shell/shell-script.txt ON ssh-server AS result WITHIN 15000 ms