Skip to content

Instantly share code, notes, and snippets.

@tjdett
Last active July 29, 2016 09:03
Show Gist options
  • Save tjdett/368ad9397e74034dc38a1d2928ea98e3 to your computer and use it in GitHub Desktop.
Save tjdett/368ad9397e74034dc38a1d2928ea98e3 to your computer and use it in GitHub Desktop.
Find the server with lowest latency over HTTPS using nmap & xmlstarlet
#!/bin/sh
nmap -oX - -n -sn "$@" | xmlstarlet sel -t -m '//host' -v 'concat(times/@srtt, " ", hostnames/hostname/@name, "
")' | sort -n
$ ./latency.sh www.google.com www.curtin.edu.au www.uq.edu.au mirror.aarnet.edu.au www.unud.ac.id www.oxford.ac.uk
884 www.uq.edu.au
1644 mirror.aarnet.edu.au
1756 www.google.com
64961 www.curtin.edu.au
221518 www.unud.ac.id
342378 www.oxford.ac.uk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment