Skip to content

Instantly share code, notes, and snippets.

@commuterjoy
Created October 13, 2016 21: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 commuterjoy/8ca9d826624bd2c622a59d5ba408acae to your computer and use it in GitHub Desktop.
Save commuterjoy/8ca9d826624bd2c622a59d5ba408acae to your computer and use it in GitHub Desktop.
View a website's SSL certificate
/*
* 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