diff options
| author | Louis Burda <quent.burda@gmail.com> | 2021-06-24 02:52:21 +0200 |
|---|---|---|
| committer | Louis Burda <quent.burda@gmail.com> | 2021-06-24 02:52:51 +0200 |
| commit | a0bd3d833d916cadd23d17d0b3784e28c729967d (patch) | |
| tree | dea52e19b1518f1489669c8a1e29d340ced61989 /checker/test.sh | |
| parent | aeb66a7b19008fabecbca23a1e21a9d6942ec28a (diff) | |
| download | enowars5-service-stldoctor-a0bd3d833d916cadd23d17d0b3784e28c729967d.tar.gz enowars5-service-stldoctor-a0bd3d833d916cadd23d17d0b3784e28c729967d.zip | |
various fixes made while stress-testing exploit
Diffstat (limited to 'checker/test.sh')
| -rw-r--r-- | checker/test.sh | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/checker/test.sh b/checker/test.sh index 9b2d08e..c3df08c 100644 --- a/checker/test.sh +++ b/checker/test.sh @@ -26,14 +26,15 @@ except: try() { cmd="$1" - tmpfile="/tmp/checker-log-$BASHPID" + pid=$BASHPID + tmpfile="/tmp/checker-log-$pid" [ -e "$tmpfile" ] && rm "$tmpfile" if [ $# -lt 2 ]; then variant=0 else variant=$2 fi - taskid=$$ + taskid=$pid if [ ! -z "$REMOTE" ]; then python3 enoreq.py -j True -A http://localhost:9091 -a $REMOTE \ --flag ENOTESTFLAG123= --flag_regex 'ENO.*=' -i $taskid \ @@ -46,18 +47,18 @@ try() { res="$(cat $tmpfile | grep -a Result: | tail -n1 | grep -a -o OK)" fi if [ "$res" != "OK" ]; then - newfile="fails/err-$(ls fails | wc -l)" + newfile="fails/err-$pid" ( echo "METHOD $@" + echo "RESULT $res" + echo "TASK $taskid" cat "$tmpfile" if [ ! -z "$REMOTE" -a -e "$ENOLOGMESSAGE_PARSER" ]; then - docker-compose logs --tail=400 | grep '"taskId": '$taskid | $ENOLOGMESSAGE_PARSER + docker-compose logs --tail=2000 | grep '"taskId": '$taskid | $ENOLOGMESSAGE_PARSER fi ) > "$newfile" - echo -ne "Executing $cmd with variant $variant.. $res ($newfile)\n" - else - echo -ne "Executing $cmd with variant $variant.. $res\n" fi + echo -ne "Executing $cmd with variant $variant.. $res (TASK: $taskid)\n" } try-all() { @@ -82,16 +83,23 @@ try-all() { try exploit 1 } -if [ $# -ge 2 ]; then +one-of() { + for arg in ${@:2}; do + [ "$1" == "$arg" ] && return 0 + done + return 1 +} + +if one-of "$1" putflag getflag putnoise getnoise havoc exploit; then try $@ elif [ "$1" == "test-exploits" ]; then try exploit 0 try exploit 1 elif [ "$1" == "stress-test" ]; then mkdir -p fails - while [ 1 ]; do - try-all & - sleep 2 + count=${2:-100} + for i in $(seq $count); do + try ${3:-exploit} ${4:-0} & done else try-all |
