Skip to content

Instantly share code, notes, and snippets.

@manesec
Last active October 28, 2023 11:41
Show Gist options
  • Save manesec/9854551b706b675926350bffd55858ff to your computer and use it in GitHub Desktop.
Save manesec/9854551b706b675926350bffd55858ff to your computer and use it in GitHub Desktop.
Use for Ping Monitor
interface="$(ip tuntap show | cut -d : -f1 | head -n 1)"
ip=`ip -j route list table all | jq -r '.[] | select(.dev=="'$interface'") | .gateway' | grep -v null | head -n 1`
ping $ip -W 1 -c 1| awk -F'/' 'END{ print (/^rtt/? " - "$5" ms":"") }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment