2016-01-13 10:21:01 +01:00
|
|
|
#!/usr/bin/perl
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use Data::Dumper;
|
|
|
|
|
|
|
|
my @spec;
|
|
|
|
my %ciphers;
|
|
|
|
|
2017-05-15 20:53:09 +02:00
|
|
|
# Turn cipher section of page like this https://www.ssllabs.com/ssltest/viewClient.html?name=Android&version=4.0.4
|
2016-01-13 10:21:01 +01:00
|
|
|
# into an openssl cipher spec
|
|
|
|
|
2017-05-15 20:53:09 +02:00
|
|
|
foreach my $line ( split /\n/, `../bin/openssl.Linux.x86_64 ciphers -V 'ALL:COMPLEMENTOFALL:\@STRENGTH'`) {
|
2016-01-13 10:21:01 +01:00
|
|
|
my @fields = split /\s+/, $line;
|
|
|
|
my $hex = "";
|
|
|
|
foreach my $byte ( split /,/, $fields[1] ) {
|
|
|
|
$byte = lc $byte;
|
|
|
|
$byte =~ s/^0x//;
|
|
|
|
$hex .= $byte;
|
|
|
|
}
|
|
|
|
$hex =~ s/^0+//;
|
|
|
|
$ciphers{"0x$hex"} = $fields[3];
|
|
|
|
}
|
|
|
|
|
|
|
|
while (<>) {
|
|
|
|
chomp;
|
|
|
|
if ( $_ =~ /^(TLS|SSL)/ ) {
|
|
|
|
if ( $_ !~ /^TLS_EMPTY_RENEGOTIATION_INFO_SCSV/ ) {
|
|
|
|
$_ =~ /(0x[0-9a-f]+)/;
|
|
|
|
if ( $1 ) {
|
|
|
|
push @spec, $ciphers{$1};
|
|
|
|
unless ( $ciphers{$1} ) {
|
|
|
|
die "Unable to find cipher for $1";
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
print "** $_\n";
|
|
|
|
}
|
|
|
|
}
|
2017-05-15 20:53:09 +02:00
|
|
|
}
|
2016-01-13 10:21:01 +01:00
|
|
|
}
|
|
|
|
print join ":", @spec;
|
|
|
|
print "\n";
|
|
|
|
my $count = @spec;
|
|
|
|
print "$count ciphers\n";
|
2021-05-31 22:39:22 +02:00
|
|
|
|
|
|
|
# vim:ts=5:sw=5:expandtab
|