aboutsummaryrefslogtreecommitdiffstats
path: root/service/src/test.sh
diff options
context:
space:
mode:
Diffstat (limited to 'service/src/test.sh')
-rw-r--r--service/src/test.sh36
1 files changed, 15 insertions, 21 deletions
diff --git a/service/src/test.sh b/service/src/test.sh
index c9e5af3..5af9a16 100644
--- a/service/src/test.sh
+++ b/service/src/test.sh
@@ -2,7 +2,10 @@
set -e
-# RUN_REMOTE=1
+# RUNTYPE=1
+
+SCRIPTPATH="$(dirname $(readlink -f "$0"))"
+cd "$SCRIPTPATH"
export RESULTDIR="../data/scans"
export ECHO_INPUT=1
@@ -30,8 +33,10 @@ checkleaks() {
}
connect() {
- if [ $RUN_REMOTE ]; then
+ if [ "$RUNTYPE" == "remote" ]; then
nc localhost 9000
+ elif [ "$RUNTYPE" == "debug" ]; then
+ checkleaks
else
./stldoctor
fi
@@ -58,7 +63,7 @@ elif [ "$1" == "poc" ]; then
announce "Testing Proof-Of-Concept"
- rm -rf "$RESULTDIR"/*
+ [ ! -z "$RESULTDIR" ] && rm -rf "$RESULTDIR"/*
echo -e "\n--- Uploading target STL ---\n" 1>&2
(
@@ -66,6 +71,7 @@ elif [ "$1" == "poc" ]; then
echo "submit"
cat tests/flag1.stl | wc -c
cat tests/flag1.stl
+ echo "N0TaFL4G"
echo "exit"
) | connect
@@ -75,7 +81,7 @@ elif [ "$1" == "poc" ]; then
echo "submit"
cat tests/evil1.stl | wc -c
cat tests/evil1.stl
- echo -e "AAAA\xff"
+ echo "EV1L"
echo "exit"
) | connect
@@ -85,38 +91,26 @@ elif [ "$1" == "poc" ]; then
# try index 0
echo "query"
- echo -e "AAAA\xff"
+ echo "EV1L"
echo "0"
echo "n"
- echo "query"
+ echo "query last"
echo "0"
echo "n"
- # reset cached result
- echo "submit"
- echo "2"
- echo "aa"
-
# try index 1
echo "query"
- echo -e "AAAA\xff"
+ echo -e "EV1L"
echo "0"
echo "n"
- echo "query"
+ echo "query last"
echo "1"
echo "n"
echo "exit"
) | connect
else
- (
- echo "submit"
- echo "2"
- echo "AA"
- echo "AAAA"
- echo "exit"
- ) | connect
-
+ connect
fi