diff options
| author | Louis Burda <quent.burda@gmail.com> | 2021-05-29 14:24:31 +0200 |
|---|---|---|
| committer | Louis Burda <quent.burda@gmail.com> | 2021-05-29 14:24:31 +0200 |
| commit | 13b65f01132c41be9ab8d9f92c2c5ca605c366d8 (patch) | |
| tree | 74bd5b4dee779e4600d416adf4abcd4f621addab /service/tests | |
| parent | 62d99253144a14648c4da1c2a60c01e7b06ef02c (diff) | |
| download | enowars5-service-stldoctor-13b65f01132c41be9ab8d9f92c2c5ca605c366d8.tar.gz enowars5-service-stldoctor-13b65f01132c41be9ab8d9f92c2c5ca605c366d8.zip | |
changed repo structure and commited releease files such that default docker-compose worklow commands work in testvm
Diffstat (limited to 'service/tests')
| -rw-r--r-- | service/tests/data/evil1.stl | 9 | ||||
| -rw-r--r-- | service/tests/data/flag1.stl | 16 | ||||
| -rw-r--r-- | service/tests/data/sample-ascii.stl | 16 | ||||
| -rw-r--r-- | service/tests/data/sample-binary.stl | bin | 134 -> 0 bytes | |||
| -rw-r--r-- | service/tests/test.sh | 200 |
5 files changed, 0 insertions, 241 deletions
diff --git a/service/tests/data/evil1.stl b/service/tests/data/evil1.stl deleted file mode 100644 index 706e9e2..0000000 --- a/service/tests/data/evil1.stl +++ /dev/null @@ -1,9 +0,0 @@ -solid test˙ -facet normal 0 0 1.0 - outer loop - vertex 1 0 0 - vertex 1 1 0 - vertex 0 1 0 - endloop - endfacet -endsolid diff --git a/service/tests/data/flag1.stl b/service/tests/data/flag1.stl deleted file mode 100644 index f2a3854..0000000 --- a/service/tests/data/flag1.stl +++ /dev/null @@ -1,16 +0,0 @@ -solid ENO{TESTFLAG} - facet normal 1.0 0 0 - outer loop - vertex 0 1 0 - vertex 0 1 1 - vertex 0 0 1 - endloop - endfacet - facet normal 0 0 1.0 - outer loop - vertex 1 0 0 - vertex 1 1 0 - vertex 0 1 0 - endloop - endfacet -endsolid diff --git a/service/tests/data/sample-ascii.stl b/service/tests/data/sample-ascii.stl deleted file mode 100644 index e3c89ef..0000000 --- a/service/tests/data/sample-ascii.stl +++ /dev/null @@ -1,16 +0,0 @@ -solid test - facet normal 1.0 0 0 - outer loop - vertex 0 1 0 - vertex 0 1 1 - vertex 0 0 1 - endloop - endfacet - facet normal 0 0 1.0 - outer loop - vertex 1 0 0 - vertex 1 1 0 - vertex 0 1 0 - endloop - endfacet -endsolid test diff --git a/service/tests/data/sample-binary.stl b/service/tests/data/sample-binary.stl Binary files differdeleted file mode 100644 index 13c02e4..0000000 --- a/service/tests/data/sample-binary.stl +++ /dev/null diff --git a/service/tests/test.sh b/service/tests/test.sh deleted file mode 100644 index 4835024..0000000 --- a/service/tests/test.sh +++ /dev/null @@ -1,200 +0,0 @@ -#!/bin/sh - -set -e - -if [ -z "$SRCDIR" -o -z "$DATADIR" ]; then - echo "Missing either SRCDIR or DATADIR env vars" - exit 1 -fi - -export RESULTDIR="$DATADIR/uploads" -export ECHO_INPUT=1 - -SCRIPTPATH="$(dirname $(readlink -f "$0"))" -TESTDATA="$SCRIPTPATH/data" - -shopt -s expand_aliases -alias pushd="pushd &>/dev/null" -alias popd="popd &>/dev/null" - -pushd "$SRCDIR" - -announce() { - count=$(echo "$1" | wc -c) - python3 -c " -import math -s = '$1' -c = 80 -print() -print('#'*c) -print('#' + ' '*math.floor((c - len(s))/2-1) + s + ' '*math.ceil((c - len(s))/2-1) + '#') -print('#'*c) -print() - " -} - -checkleaks() { - valgrind --leak-check=full --show-leak-kinds=all ./build/stldoctor 2>&1 | tee /tmp/testlog - if [ -z "$(grep "no leaks are possible" /tmp/testlog)" ]; then - echo "Valgrind exited with errors!" - exit 1 - fi -} - -connect() { - if [ "$RUNTYPE" == "remote" ]; then - nc localhost 9090 - elif [ "$RUNTYPE" == "debug" ]; then - checkleaks - else - ./build/stldoctor - fi -} - -cleanuploads() { - [ ! -z "$RESULTDIR" ] && rm -rf "$RESULTDIR" - mkdir -p "$RESULTDIR" -} - -if [ "$1" == "stl-leaks" ]; then - cleanuploads - - announce "Testing ASCII STL Parsing" - ( - echo "echo" - echo "upload" - cat "$TESTDATA/sample-ascii.stl" | wc -c - cat "$TESTDATA/sample-ascii.stl" - echo "ASCII-testname" - ) | checkleaks - - announce "Testing BIN STL Parsing" - ( - echo "echo" - echo "upload" - cat "$TESTDATA/sample-binary.stl" | wc -c - cat "$TESTDATA/sample-binary.stl" - echo "BIN-testname" - ) | checkleaks - -elif [ "$1" == "stl-upload" ]; then - cleanuploads - - popd - file="$(realpath $2)" - if [ ! -e "$file" ]; then - echo "Supply a file to upload" - exit 1 - fi - pushd "$SRCDIR" - - name="${3:-samplefile}" - ( - echo "echo" - echo "upload" - cat "$file" | wc -c - cat "$file" - echo "$name" - ) | checkleaks - -elif [ "$1" == "vuln1" ]; then - cleanuploads - - announce "Testing Flagstore 1" - - echo -e "\n--- Uploading target STL ---\n" 1>&2 - ( - echo "echo" - echo "upload" - cat "$TESTDATA/flag1.stl" | wc -c - cat "$TESTDATA/flag1.stl" - echo "N0TaFL4G" - echo "exit" - ) | connect - - echo -e "\n--- Uploading evil STL ---\n" 1>&2 - ( - echo "echo" - echo "upload" - cat "$TESTDATA/evil1.stl" | wc -c - cat "$TESTDATA/evil1.stl" - echo "EV1L" - echo "exit" - ) | connect - - echo -e "\n--- Testing Exploit ---\n" 1>&2 - ( - echo "echo" - - # try index 0 - echo "search" - echo "EV1L" - echo "0" - echo "n" - - echo "search last" - echo "0" - echo "n" - - # try index 1 - echo "search" - echo -e "EV1L" - echo "0" - echo "n" - - echo "search last" - echo "1" - echo "n" - echo "exit" - ) | connect - -elif [ "$1" == "vuln2" ]; then - cleanuploads - - announce "Testing Flagstore 2" - - echo -e "\n--- Uploading target STL ---\n" 1>&2 - ( - echo "echo" - echo "auth test" - echo "upload" - cat "$TESTDATA/flag1.stl" | wc -c - cat "$TESTDATA/flag1.stl" - echo "N0TaFL4G" - echo "exit" - ) | connect - - echo -e "\n--- Testing Exploit ---\n" 1>&2 - ( - echo "echo" - echo -e "search \xff\xff\xff\xff\xff0000000000000000" - echo "auth" - echo "list" - echo "exit" - ) | connect - -elif [ "$1" == "auth-upload" ]; then - cleanuploads - - ( - echo "echo" - - echo "auth test" - echo "upload" - cat "$TESTDATA/sample-ascii.stl" | wc -c - cat "$TESTDATA/sample-ascii.stl" - echo "testname" - ) | connect - - ( - echo "echo" - - echo "auth test" - echo "list" - echo "search testname" - ) | connect -else - connect -fi - -popd |
