Last active
August 29, 2015 14:14
-
-
Save invalidusrname/20f4f8d22fb45c97f730 to your computer and use it in GitHub Desktop.
Check certs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'net/https' | |
| url = "https://www.google.com" | |
| uri = URI.parse(url) | |
| http = Net::HTTP.new(uri.host, uri.port) | |
| http.use_ssl = true | |
| http.verify_mode = OpenSSL::SSL::VERIFY_PEER | |
| http.start { |h| @cert = h.peer_cert } | |
| @cert | |
| @cert.not_after | |
| (@cert.not_after - Time.now) / (60*60*24).to_i |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment