Skip to content

Instantly share code, notes, and snippets.

@5argon
Last active February 20, 2017 02:20
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 5argon/ed0b3e7f1dd61411000e4e17a39ae63e to your computer and use it in GitHub Desktop.
Save 5argon/ed0b3e7f1dd61411000e4e17a39ae63e to your computer and use it in GitHub Desktop.
Get an SRV record's port number + target from a URL. (OSX/Linux, or maybe Windows if you have grep) Separated by a whitespace.
URL=$1
nslookup -type=SRV $URL | grep -Eo "service.*" | grep -Eo "[0-9]*[ ][^ ]*$"
@5argon
Copy link
Author

5argon commented Feb 20, 2017

Example : ./srvport.sh mmnssh.5argon.info
Returns 6560 r.5argon.info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment