Skip to content

Instantly share code, notes, and snippets.

@ldionmarcil
Created March 4, 2024 18:03
Show Gist options
  • Save ldionmarcil/5e842a550a4c3c5474061dbc3b2087e3 to your computer and use it in GitHub Desktop.
Save ldionmarcil/5e842a550a4c3c5474061dbc3b2087e3 to your computer and use it in GitHub Desktop.
find url common name and alternative name
function cert {
# accepts urls/hostnames as stdin
# returns Common Name + Subject Alternative Name from responding http server
if [ $# -eq 0 ]; then
# human readable
httpx -silent -json -tls-grab | jq -r '"\u001b[34m\(.url)\u001b[0m \(.tls | [.subject_cn] + .subject_an | unique | join(" "))"'
else
# batching
httpx -silent -json -tls-grab | jq -r '(.tls | [.subject_cn] + .subject_an | unique | join("\n"))'
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment