-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
ipinfo.sh
58 lines (50 loc) · 1.16 KB
/
ipinfo.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
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
# Teal Dulcet
# Outputs the systems public IP addresses
# wget -qO - https://raw.github.com/tdulcet/Linux-System-Information/master/ipinfo.sh | bash -s --
# ./ipinfo.sh
# Adapted from: https://github.com/rsp/scripts/blob/master/externalip.md
if [[ $# -ne 0 ]]; then
echo "Usage: $0" >&2
exit 1
fi
urls=(
alma.ch/myip.cgi
api.ipify.org/
# bot.whatismyipaddress.com/
canhazip.com/
checkip.amazonaws.com/
curlmyip.net/
# diagnostic.opendns.com/myip
echoip.de/
eth0.me/
icanhazip.com/
ident.me/ # v4.ident.me/ # v6.ident.me/
ifconfig.co/
ifconfig.me/
ifconfig.pro/
ipaddr.site/
ipecho.net/plain
ipinfo.in/
ipinfo.io/ip
ip.tyk.nu/
l2.io/ip
# myip.addr.space/
# tnx.nl/ip
wgetip.com/
ifconfig.io/ip
# gso.cs.pdx.edu/ip/
)
echo -e "\nPublic IP addresses"
for ip in 4 6; do
echo -e "\nIPv$ip address Best HTTPS response times:\n"
for url in "${urls[@]}"; do
answer=''
if cout=$(curl -"$ip" -m10 -sSLw '\n%{time_total}\n' "https://$url" 2>&1); then
answer=$(echo "$cout" | head -n 1)
fi
time=$(echo "$cout" | tail -n 1)
printf '%s seconds\thttps://%s\t%s\n' "$time" "$url" "${answer:--}"
done | sort -n | column -t -s $'\t'
done
echo