diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 17:11:11 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 17:11:11 +0000 |
commit | ba28aa09cebfba17fd16de2af6fedf7ecc76eea5 (patch) | |
tree | 44e2ff1493776a06e95c359c53a1cabca5d8a8d4 /t/61_diff_testsslsh.t | |
parent | Initial commit. (diff) | |
download | testssl.sh-ba28aa09cebfba17fd16de2af6fedf7ecc76eea5.tar.xz testssl.sh-ba28aa09cebfba17fd16de2af6fedf7ecc76eea5.zip |
Adding upstream version 3.2~rc3+dfsg.upstream/3.2_rc3+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 't/61_diff_testsslsh.t')
-rwxr-xr-x | t/61_diff_testsslsh.t | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/t/61_diff_testsslsh.t b/t/61_diff_testsslsh.t new file mode 100755 index 0000000..f4070b1 --- /dev/null +++ b/t/61_diff_testsslsh.t @@ -0,0 +1,70 @@ +#!/usr/bin/env perl + +# Baseline diff test against testssl.sh (csv output) +# +# We don't use a full run yet and only the certificate section. +# There we would need to blacklist at least: +# cert_serialNumber, cert_fingerprintSHA1, cert_fingerprintSHA256, cert +# cert_expirationStatus, cert_notBefore, cert_notAfter, cert_caIssuers, intermediate_cert +# +# help is appreciated here + +use strict; +use Test::More; +use Data::Dumper; +use Text::Diff; + +my $tests = 0; +my $prg="./testssl.sh"; +my $master_socket_csv="./t/baseline_data/default_testssl.csvfile"; +my $socket_csv="tmp.csv"; +my $check2run="-p -s -P --fs -h -U -c -q --ip=one --color 0 --csvfile $socket_csv"; +#my $check2run="-p --color 0 --csvfile $socket_csv"; +my $uri="testssl.sh"; +my $diff=""; + +die "Unable to open $prg" unless -f $prg; +die "Unable to open $master_socket_csv" unless -f $master_socket_csv; + + +# Provide proper start conditions +unlink "tmp.csv"; + +# Title +printf "\n%s\n", "Diff unit test IPv4 against \"$uri\""; + +#1 run +`$prg $check2run $uri 2>&1`; + +$diff = diff $socket_csv, $master_socket_csv; + +$socket_csv=`cat tmp.csv`; +$master_socket_csv=`cat $master_socket_csv`; + +# Filter for changes that are allowed to occur +$socket_csv=~ s/HTTP_clock_skew.*\n//g; +$master_socket_csv=~ s/HTTP_clock_skew.*\n//g; + +# DROWN +$socket_csv=~ s/censys.io.*\n//g; +$master_socket_csv=~ s/censys.io.*\n//g; + +# HTTP time +$socket_csv=~ s/HTTP_headerTime.*\n//g; +$master_socket_csv=~ s/HTTP_headerTime.*\n//g; + +# Compare the differences to the master file -- and print differences if there were detected. +# +cmp_ok($socket_csv, "eq", $master_socket_csv, "Check whether CSV output matches master file from $uri") or + diag ("\n%s\n", "$diff"); + +$tests++; + +unlink "tmp.csv"; + +done_testing($tests); +printf "\n"; + + +# vim:ts=5:sw=5:expandtab + |