Created
September 24, 2012 16:53
-
-
Save nibalizer/3776982 to your computer and use it in GitHub Desktop.
script to get ntp servers from ntp.org
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/zsh | |
| link_base=http://support.ntp.org | |
| relative_links=`curl http://support.ntp.org/bin/view/Servers/StratumOneTimeServers 2>/dev/null | grep Col1 | grep Servers | awk '{print $6}' | cut -d \" -f 2 | grep -v '<a' | grep -v nofollow` | |
| for url_end in `echo "$relative_links" ` | |
| do | |
| #echo "$link_base$url_end" | |
| curl $link_base$url_end 2>/dev/null | grep -A1 Address | grep -v Address | tr '\n' ' ' | read v4 v6; #echo 4: $v4; echo 6: $v6 | |
| curl $link_base$url_end 2>/dev/null | grep -A1 CountryCode | grep -v CountryCode | tr '\n' ' ' | read countrycode ; #echo Country: $countrycode | |
| curl $link_base$url_end 2>/dev/null | grep -A1 Hostname | grep -v Hostname | tr '\n' ' ' | read hname ; #echo Country: $hname | |
| # echo $hname $countrycode $v4 $v6 | |
| if `echo $v6 | grep p >/dev/null` ;then | |
| v6=None | |
| fi | |
| printf "%40s%4s%20s%40s\n" "$hname" "$countrycode" "$v4" "$v6" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

hi i\am hacker i will hack you now fuck u