-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcheck.sh
executable file
·38 lines (29 loc) · 853 Bytes
/
check.sh
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
#!/bin/sh
. ./config
. ./base/option_target.sh
# Colors
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m' # No Color
FAIL=0
for fw in `echo $param_targets`
do
if [ -d "$fw" ]; then
. "$fw/_benchmark/hello_world.sh"
url_output=$(curl -s "$url")
# expected to get the Hello World! + libs/output_data.php
if ! [[ "$url_output" =~ ^('Hello World!')(.*)(([0-9]*):(([0-9]+([.][0-9]*)?|[.][0-9]+)):([0-9]*))$ ]]; then
echo -e "${RED}❌ $fw ${NC}"
echo "$url"
if [ -x "$(command -v w3m)" ]; then
echo "$url_output" | w3m -dump -T text/html
else
echo "$url_output"
fi
FAIL=1
else
printf "%-34b %4s bytes %s\n" "${GREEN}✔ $fw ${NC}" "${#url_output}" "$url"
fi
fi
done
exit $FAIL