blob: 8887f689945cd5ad33770a5dff473b295e7c8af0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
#!/bin/bash
ipstr="$1"
SCRIPTPATH="$(dirname $(readlink -f "$0"))"
cd "$SCRIPTPATH"
export REVHASH_PATH="$SCRIPTPATH/src/revhash/revhash"
nop() { :; }
splitmsg() {
python3 -c "
import json,sys
try:
instr = sys.stdin.read().strip()
jres = json.loads(instr)
print(jres['result'])
print(jres['message'])
except:
print('INVALID')
print('INVALID')
print('FAIL:', instr, file=sys.stderr)
" || nop
}
try() {
cmd="$1"
tmpfile="/tmp/checker-log-$BASHPID"
[ -e "$tmpfile" ] && rm "$tmpfile"
if [ $# -lt 2 ]; then
variant=0
else
variant=$2
fi
if [ ! -z "$REMOTE" ]; then
python3 enoreq.py -j True -A http://localhost:9091 -a $REMOTE \
--flag ENOTESTFLAG123= --flag_regex 'ENO.*=' \
-x 4000 ${@:3} "$cmd" > "$tmpfile"
else
python3 src/checker.py -j run -v "$variant" -x 4000 \
--flag ENOTESTFLAG123= --flag_regex 'ENO.*=' \
${@:3} "$cmd" > "$tmpfile"
fi
res="$(cat $tmpfile | splitmsg | head -n1)"
if [ "$res" != "OK" ]; then
newfile="fails/err-$(ls fails | wc -l)"
(echo "METHOD $@"; cat "$tmpfile") > "$newfile"
echo "[ $(date '+%T %F') ] ERROR >>>> $newfile"
cat "$tmpfile"
fi
echo -ne "Executing $cmd with variant $variant.. $res\n"
}
try-all() {
try putflag 0
try getflag 0
try putflag 1
try getflag 1
try putnoise 0
try getnoise 0
try putflag 1
try getflag 1
try havoc 0
try havoc 1
try havoc 2
try havoc 3
try exploit 0
try exploit 1
}
if [ $# -ge 2 ]; 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
done
else
try-all
fi
exit 0
|