-
Notifications
You must be signed in to change notification settings - Fork 56
/
test_knary.sh
48 lines (39 loc) · 1.18 KB
/
test_knary.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
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
# https://stackoverflow.com/questions/394230/how-to-detect-the-os-from-a-bash-script/18434831
domain=$1
if [[ -z "$domain" ]]; then
echo "usage: $0 mycanary.com"
exit 1
fi
echo "----------------------------------"
echo "Tests running..."
echo "----------------------------------"
if [[ "$OSTYPE" == "linux-gnu" ]]; then
curl "http://test.$domain"
curl "https://test.$domain"
dig "test.dns.$domain"
elif [[ "$OSTYPE" == "darwin"* ]]; then
curl "http://test.$domain"
curl "https://test.$domain"
dig "test.dns.$domain"
elif [[ "$OSTYPE" == "cygwin" ]]; then
curl "http://test.$domain"
curl "https://test.$domain"
nslookup "test.dns.$domain"
elif [[ "$OSTYPE" == "msys" ]]; then
curl "http://test.$domain"
curl "https://test.$domain"
nslookup "test.dns.$domain"
elif [[ "$OSTYPE" == "win32" ]]; then
# I'm not sure this can happen.
nslookup "test.dns.$domain"
elif [[ "$OSTYPE" == "freebsd"* ]]; then
curl "http://test.$domain"
curl "https://test.$domain"
dig "test.dns.$domain"
else
echo "Unknown OS. Read script and run commands manually."
fi
echo "----------------------------------"
echo "Check your webhook(s) for 3 hits!"
echo "----------------------------------"