Created
October 13, 2016 21:17
-
-
Save commuterjoy/8ca9d826624bd2c622a59d5ba408acae to your computer and use it in GitHub Desktop.
View a website's SSL certificate
This file contains 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
/* | |
* Usage: | |
* | |
* node see-cert https://www.ft.com | |
* | |
*/ | |
const url = require('url'); | |
const https = require('https'); | |
const u = url.parse(process.argv[2]); | |
const req = https.request({ port: u.port, method: 'GET', host: u.host, path: u.path }, function(res){ | |
var cert = res.connection.getPeerCertificate(); | |
console.log(JSON.stringify(cert)); | |
}); | |
req.end(); | |
req.on('error', function(e) { | |
console.error(e); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment