Skip to content

Instantly share code, notes, and snippets.

@conrad784
Last active April 25, 2018 08:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save conrad784/d083c8d31d470da153011d3a3689cca0 to your computer and use it in GitHub Desktop.
Save conrad784/d083c8d31d470da153011d3a3689cca0 to your computer and use it in GitHub Desktop.
query your ipv4/6 address and print the name of the network you are in
#!/bin/sh
IPV4=$(curl -s -4 icanhazip.com)
IPV6=$(curl -s -6 icanhazip.com)
PTR4=$(curl -s -4 icanhazptr.com)
PTR6=$(curl -s -6 icanhazptr.com)
NETNAME=$(whois $IPV4 | grep netname | rev | cut -d ' ' -f1 | rev)
echo "IPV4: $IPV4"
echo "IPV6: $IPV6"
echo "PTR4: $PTR4"
echo "PTR6: $PTR6"
echo " net: $NETNAME"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment