SamuraiWTF / samuraiwtf

The main SamuraiWTF collaborative distro repo.

Home Page:https://owasp.org/www-project-samuraiwtf/#SamuraiWTF_Project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Command Module Doesn't Do Shell Expansions

corysabol opened this issue · comments

The katana command module doesn't seem to handle shell expansions very well. In the case of trying to use it to install kubectl with the following command:

curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl

It fails to fetch the file and instead resolved the subshell command as part of the URL.

Example yaml:

- name: Download kubectl bin
  command:
    cwd: /usr/bin
    cmd: curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl

It might make sense to add the ability to pass shell=True to the subprocess.run() call in found here -

results = subprocess.run(command_list, cwd=params.get('cwd'))