cortex XDR run_script and execute_commands

Showing results for 
Show  only  | Search instead for 
Did you mean: 
Please sign in to see details of an important advisory in our Customer Advisories area.

cortex XDR run_script and execute_commands

L0 Member

I've being testing some of the built in scripts that come with cortex.  i.e the #list_directories and #file_exists are working nicely.

Im having difficulty using similar parameters running the execute_commands script.

example of list_directories which works:



So on the server side, the script takes in the two parameters:
def run(path, number_of_levels):

and we get the expected results back successfully


for the execute_commands script. Im using:


On the server side I see the function takes in a list, and runs through a for loop on it:
def run(commands_list):
result = {}
for command in commands_list:


although the error returned shows:
{'reply': {'err_code': 500, 'err_msg': 'Got an invalid input while processing XDR public API', 'err_extra': 'commands_list must be of type: str'}}


I've tested the actual function on my own laptop, and it does work fine when passing it a list of commands:

Screenshot 2021-04-22 at 09.24.29.png



If anyone has any pointers, thanks




L0 Member

passing in different parameters Im finding that if I pass in a list:

{'err_code': 500,
'err_extra': 'commands_list must be of type: str',
'err_msg': 'Got an invalid input while processing XDR public API'}}
Although if I pass in as a string:

It does get though to the function, but then gets split apart into "l" and "s" in the function:


'standard_output': 'Running command <l>\n'
'stderr: \n'
'/bin/sh: l: command not found\n'
'Running command <s>\n'
'stderr: \n'
'/bin/sh: s: command not found\n'}],

  • 1 replies
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!