Skip to content

Instantly share code, notes, and snippets.

@wietze
Created October 18, 2018 13:17
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 wietze/2fde8c9386628d9f2133a263481e2eb5 to your computer and use it in GitHub Desktop.
Save wietze/2fde8c9386628d9f2133a263481e2eb5 to your computer and use it in GitHub Desktop.
One-liner to obtain the PEM file of a domain/port combination
python -c "import sys,ssl;print(ssl.get_server_certificate((sys.argv[1], sys.argv[2])))" $DOMAIN $PORT > output.pem
# Example:
# $ python -c "import sys,ssl;print ssl.get_server_certificate((sys.argv[1], sys.argv[2]))" google.com 443 > google.pem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment