Created
March 19, 2015 13:28
-
-
Save Sp1l/169f63de1af20ad75064 to your computer and use it in GitHub Desktop.
Check supported ciphers
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/local/bin/perl | |
$openssl = '/usr/local/bin/openssl'; | |
$ciphersuitelist = 'ALL'; | |
#example for smtp. see man s_client for all | |
#$opensslargs .= '-starttls imap '; | |
$opensslargs .= '-starttls smtp '; | |
#$opensslargs .= '-ssl3 '; | |
#$opensslargs .= '-tls1 '; | |
#$opensslargs .= '-tls1_1 '; | |
$opensslargs .= '-tls1_2 '; | |
if (@ARGV != 1) { | |
print "usage: $0 test-host:port\n"; | |
die(); | |
} | |
$cmd = "$openssl s_client -connect $ARGV[0]"; | |
if (length($opensslargs) > 0) { $cmd .= " $opensslargs"; } | |
$cmd .= " -cipher $ciphersuitelist"; | |
do { | |
open(SSL, "$cmd < /dev/null 2>&1 |"); | |
while (<SSL>) { | |
if ($_ =~ /^\s+Protocol\s+: (.*)$/) { $protocol = $1; } | |
if ($_ =~ /^\s+Cipher\s+: (.*)$/) { $ciphersuite = $1; } | |
} | |
close(SSL); | |
if ($? == 0) { | |
print "$protocol $ciphersuite ok\n"; | |
$cmd .= ":-" . $ciphersuite; | |
} | |
} until ($? != 0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment