pretty json format + severity levels filter

This commit is contained in:
AlGreed 2016-10-28 15:30:07 +02:00
parent ef78aec50b
commit 694e4c7b6e
2 changed files with 686 additions and 502 deletions

View File

@ -28,7 +28,7 @@ foreach my $f ( @$json ) {
if ( $f->{id} eq "expiration" ) { if ( $f->{id} eq "expiration" ) {
$found = 1; $found = 1;
like($f->{finding},qr/^Certificate Expiration.*expired\!/,"Finding reads expired."); $tests++; like($f->{finding},qr/^Certificate Expiration.*expired\!/,"Finding reads expired."); $tests++;
is($f->{severity}, "NOT ok", "Severity should be NOT ok"); $tests++; is($f->{severity}, "CRITICAL", "Severity should be CRITICAL"); $tests++;
last; last;
} }
} }
@ -56,7 +56,7 @@ foreach my $f ( @$json ) {
if ( $f->{id} eq "chain_of_trust" ) { if ( $f->{id} eq "chain_of_trust" ) {
$found = 1; $found = 1;
like($f->{finding},qr/^All certificate trust checks failed/,"Finding says certificate cannot be trusted."); $tests++; like($f->{finding},qr/^All certificate trust checks failed/,"Finding says certificate cannot be trusted."); $tests++;
is($f->{severity}, "NOT ok", "Severity should be NOT ok"); $tests++; is($f->{severity}, "CRITICAL", "Severity should be CRITICAL"); $tests++;
last; last;
} }
} }
@ -100,7 +100,7 @@ foreach my $f ( @$json ) {
if ( $f->{id} eq "chain_of_trust" ) { if ( $f->{id} eq "chain_of_trust" ) {
$found = 1; $found = 1;
like($f->{finding},qr/^All certificate trust checks failed.*incomplete/,"Finding says certificate cannot be trusted."); $tests++; like($f->{finding},qr/^All certificate trust checks failed.*incomplete/,"Finding says certificate cannot be trusted."); $tests++;
is($f->{severity}, "NOT ok", "Severity should be NOT ok"); $tests++; is($f->{severity}, "CRITICAL", "Severity should be CRITICAL"); $tests++;
last; last;
} }
} }
@ -118,7 +118,7 @@ is($found,1,"We had a finding for this in the JSON output"); $tests++;
# if ( $f->{id} eq "chain_of_trust" ) { # if ( $f->{id} eq "chain_of_trust" ) {
# $found = 1; # $found = 1;
# like($f->{finding},qr/^All certificate trust checks failed.*incomplete/,"Finding says certificate cannot be trusted."); $tests++; # like($f->{finding},qr/^All certificate trust checks failed.*incomplete/,"Finding says certificate cannot be trusted."); $tests++;
# is($f->{severity}, "NOT ok", "Severity should be NOT ok"); $tests++; # is($f->{severity}, "CRITICAL", "Severity should be CRITICAL"); $tests++;
# last; # last;
# } # }
#} #}
@ -132,4 +132,4 @@ sub json($) {
$file = `cat $file`; $file = `cat $file`;
unlink $file; unlink $file;
return from_json($file); return from_json($file);
} }

1178
testssl.sh

File diff suppressed because it is too large Load Diff