removing deprecated test scripts
This commit is contained in:
parent
8a0b2cb190
commit
302cac2b51
@ -1,22 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# Details for our bs user when testing things
|
|
||||||
# raw from `-c same` flag
|
|
||||||
# {"id":5,"secret":"JYFKgDOgEAn2vJISwRSkRKn3kNE2EQD0dTFOG24UipQ9kQfBOura06PYf-hYGdFbCNeDJy2LxLu-9N13S8Auaw==","name":"adminsama","joindate":1596865071,"status":0,"permissions":18446744073709551615}
|
|
||||||
export id=5
|
|
||||||
export secret='JYFKgDOgEAn2vJISwRSkRKn3kNE2EQD0dTFOG24UipQ9kQfBOura06PYf-hYGdFbCNeDJy2LxLu-9N13S8Auaw=='
|
|
||||||
export name='adminsama'
|
|
||||||
export joindate='1596865071'
|
|
||||||
export status=0
|
|
||||||
export permissions='18446744073709551615'
|
|
||||||
|
|
||||||
export simple_key='{"secret":"'"$secret"'","id":'$id'}'
|
|
||||||
|
|
||||||
export url='localhost:8888'
|
|
||||||
|
|
||||||
export GET='-X GET'
|
|
||||||
export POST='-X POST'
|
|
||||||
|
|
||||||
export arrows='>>>>>'
|
|
||||||
export line='============='
|
|
||||||
|
|
||||||
export crl='curl --silent -i'
|
|
@ -1,53 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# This script is basically just a convenient launch pad script for running all
|
|
||||||
# the tests at once
|
|
||||||
# Most tests should be runnable by doing ./script.sh name_of_test
|
|
||||||
|
|
||||||
|
|
||||||
# First the 'good' input tests
|
|
||||||
# This is to say that we get input that:
|
|
||||||
# 1. is properly formatted
|
|
||||||
# 2. has all the info we need & none we don't
|
|
||||||
# 3. has basically nothing malicious about it
|
|
||||||
|
|
||||||
log_result() {
|
|
||||||
name=$1
|
|
||||||
expect=$2
|
|
||||||
actual=$3
|
|
||||||
result=$4
|
|
||||||
|
|
||||||
green='\033[1;32m'
|
|
||||||
red='\033[1;91m'
|
|
||||||
nc='\033[0m'
|
|
||||||
if [ $expect != $actual ];then
|
|
||||||
echo -e ${red}${name}${nc} ${green}$expect ${red}$actual${nc}
|
|
||||||
echo -e ${red}==========${nc}
|
|
||||||
echo "$result" | sed 's/^/\t/g'
|
|
||||||
echo -e ${red}==========${nc}
|
|
||||||
else
|
|
||||||
echo -e ${green}${name}${nc} $expect $actual
|
|
||||||
if [ ! -z "$_show_body" ];then
|
|
||||||
echo ==========
|
|
||||||
echo "$result" | sed 's/^/\t/g'
|
|
||||||
echo ==========
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ "$1" = "body" ];then
|
|
||||||
export _show_body=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
source ./common.sh
|
|
||||||
export -f log_result
|
|
||||||
|
|
||||||
echo ================================
|
|
||||||
echo TestName ExpectedCode ActualCode
|
|
||||||
|
|
||||||
bash ./verify_basic_cases.sh
|
|
||||||
|
|
||||||
bash ./verify_err_cases.sh
|
|
||||||
|
|
||||||
bash ./verify_mal_cases.sh
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
active_tests='malicious_list_channels'
|
|
||||||
|
|
||||||
malicious_list_channels() {
|
|
||||||
key='{"secret": ";-- select * from members;"}'
|
|
||||||
result=$(curl --silent -i -X GET localhost:8888/channels/list -d '{"secret": "-- select * from members;"}')
|
|
||||||
code=$(echo "$result" | grep HTTP\/1.1 | awk '{print $2}')
|
|
||||||
log_result malicious_list_channels 401 $code "$result"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Dispatcher to run our tests
|
|
||||||
if [ -z $1 ];then
|
|
||||||
for cmd in $active_tests;do
|
|
||||||
$cmd
|
|
||||||
done
|
|
||||||
else
|
|
||||||
for cmd in $@;do
|
|
||||||
$cmd
|
|
||||||
echo '\n'$?
|
|
||||||
done
|
|
||||||
fi
|
|
Loading…
Reference in New Issue
Block a user