Menu

[0caea8]: / multinetwork / quick_test.sh  Maximize  Restore  History

Download this file

49 lines (39 with data), 1.0 kB

 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
nethandle=0
readonly TEST_HOST="connectivitycheck.gstatic.com"
readonly TEST_PATH="/generate_204"
readonly PREFIX=">>>"
function getUrls() {
if [ ! -z $(echo "$1" | sed -e 's/[^:]//g') ]; then
echo "http://[$1]$TEST_PATH"
echo "http://[$1]:80$TEST_PATH"
else
echo "http://$1$TEST_PATH"
echo "http://$1:80$TEST_PATH"
fi
}
function toHex() {
readonly local hexValue=$(bc -q 2>/dev/null << EOT
obase=16
$1
EOT
)
if [ ! -z "$hexValue" ]; then
echo "0x$hexValue"
fi
}
if [ ! -z "$1" ]; then
nethandle="$1"
fi
echo "$PREFIX Using nethandle $nethandle ($(toHex $nethandle))"
echo ""
readonly IPADDRESSES=$(
adb shell /system/xbin/dnschk --nethandle $nethandle $TEST_HOST |
sed -e 's/#.*//' -e '/^$/d')
for host in $TEST_HOST $IPADDRESSES; do
urls=$(getUrls $host)
for url in $urls; do
echo "$PREFIX Checking $url" >&2
adb shell /system/xbin/httpurl --nethandle $nethandle "$url"
done
done
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.