Exec
This endpoint performs ad-hoc executions. It will wait 50 seconds for a sucessful response (200), otherwise return an Accepted status code (202) meaning the execution will be held asynchronously. The outcome could be obtained later on by fetching the resource using the attribute id
.
The payload of this request is used with the Connection resource to construct the command to be executed in the remote agent.
- The
script
attribute is passed as stdin to the Connection resourcecommand
attribute. - The attribute
client_args
is appended to the suffix of thecommand
.
For example, the following connection:
{
"name": "bash-connection",
"command": ["/bin/bash"],
"type": "custom"
}
With the following payload:
{
"script": "echo 'hello world'",
"client_args": ["-x"],
"connection": "bash-connection"
}
Will perform an ad-hoc shell execution as:
/bin/bash -x <<EOF
echo 'hello world'
EOF
Body
Additional arguments that will be joined when construction the command to be executed
The target connection
DEPRECATED in flavor of metadata
Metadata contains attributes that is going to be available in the Session resource
The input of the execution
Response
The amount of time the execution took in miliseconds
The shell exit code, any non zero code means an error
- 0 - Linux success exit code
- -2 - internal gateway code that means it was unable to obtain a valid exit code number from the agent outcome packet
- 254 - internal agent code that means it was unable to obtain a valid exit code number from the process
Inform if the connection has review enabled
Output contains an utf-8 output containing the outcome of the ad-hoc execution
Status reports if the outcome of the execution
- success - The execution was executed with success
- failed - In case of internal error or when the agent returns an exit code greater than 0 or different than -2
- running - The execution may still be running.
success
, failed
, running
Each execution creates a unique session id
If the `output`` field is truncated or not