1
0
mirror of https://github.com/drwetter/testssl.sh.git synced 2025-07-13 01:01:57 +02:00
Files
.github
bin
doc
etc
t
utils
00_unittest_baseline.sh
ccs-injection.bash
checkcert.sh
create_ca_hashes.sh
curves.bash
docker-debian10.tls13only.start.sh
docker-nginx.tls13-earlydata.start.sh
generate_static_cipher_lists.sh
gmap2testssl.sh
heartbleed.bash
hexstream2cipher.sh
hexstream2curves.sh
make-openssl.sh
make-openssl111.sh
parse_client_ciphers.pl
prototype.ssl2proto-check.bash
prototype.tls-protocol-checker.bash
resume.sh
ticketbleed.bash
update_client_sim_data.pl
.dockerignore
.editorconfig
.gitattributes
.gitignore
CHANGELOG.md
CONTRIBUTING.md
CREDITS.md
Coding_Convention.md
Dockerfile
Dockerfile.git
Dockerfile.md
LICENSE
Readme.md
openssl-iana.mapping.html
testssl.sh
testssl.sh/utils/parse_client_ciphers.pl
2021-06-01 14:40:24 +08:00

46 lines
943 B
Perl
Executable File

#!/usr/bin/perl
use strict;
use Data::Dumper;
my @spec;
my %ciphers;
# Turn cipher section of page like this https://www.ssllabs.com/ssltest/viewClient.html?name=Android&version=4.0.4
# into an openssl cipher spec
foreach my $line ( split /\n/, `../bin/openssl.Linux.x86_64 ciphers -V 'ALL:COMPLEMENTOFALL:\@STRENGTH'`) {
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";
}
}
}
}
print join ":", @spec;
print "\n";
my $count = @spec;
print "$count ciphers\n";
# vim:ts=5:sw=5:expandtab