Last active
February 27, 2020 14:44
-
-
Save julien-f/aad2bf5ae906bccf005ff0627f83d8a8 to your computer and use it in GitHub Desktop.
Show TLS/SSL certificate (node)
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
#!/usr/bin/env node | |
const [, , host, port = 443, ca] = process.argv; | |
require("tls") | |
.connect( | |
{ host, port, rejectUnauthorized: false, servername: host }, | |
function() { | |
console.log(this.getPeerCertificate()); | |
this.destroy(); | |
} | |
) | |
.on("error", function(error) { | |
console.error(error); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment