You can execute a command or the executable script directly on an agent via active response using API, but you need the script defined in the Wazuh server itself and placed on the agent. You can check out the API documentation here for more clarity:
https://documentation.wazuh.com/current/user-manual/api/reference.html#tag/Active-response You can navigate to the server management DEVTools and place the query below:
PUT /active-response?agents_list=005
{
"arguments": [
"string"
],
"command": "!test123",
"alert": {
"data": {}
}
}This would allow you to run the command test123 on the remotely defined agent 005.
And on the Wazuh server, you can have the command stated below: