From 8457c1ce9efc26ad0602fd64bb4eaba503852927 Mon Sep 17 00:00:00 2001 From: AlGreed Date: Sat, 4 Feb 2017 01:38:18 +0100 Subject: [PATCH 1/4] corrected path to common_primes_file in logjam --- testssl.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/testssl.sh b/testssl.sh index 904a834..1d15944 100755 --- a/testssl.sh +++ b/testssl.sh @@ -9889,7 +9889,10 @@ run_logjam() { len_dh_p="$((4*${#dh_p}))" debugme outln "len(dh_p): $len_dh_p | dh_p: $dh_p" echo "$dh_p" > $TEMPDIR/dh_p.txt - if [[ ! -s "$common_primes_file" ]]; then + + DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + + if [[ ! -s "$DIR$common_primes_file" ]]; then local_problem_ln "couldn't read common primes file $common_primes_file" out "${spaces}" fileout "LOGJAM_common primes" "WARN" "couldn't read common primes file $common_primes_file" From 6b8de02072f65ac2b8d2bb1695696591451f64ba Mon Sep 17 00:00:00 2001 From: AlGreed Date: Thu, 9 Mar 2017 18:55:04 +0100 Subject: [PATCH 2/4] Fixed broken JSON-PRETTY format. Added test to check severity levels --- t/100_report_structure.t | 53 ++++++++++++++++++++++++++++++++++++++++ testssl.sh | 2 +- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 t/100_report_structure.t diff --git a/t/100_report_structure.t b/t/100_report_structure.t new file mode 100644 index 0000000..5fdfb47 --- /dev/null +++ b/t/100_report_structure.t @@ -0,0 +1,53 @@ +#!/usr/bin/env perl + +use strict; +use Test::More; +use Data::Dumper; +use JSON; + +my ( + $out, + $json, + $json_pretty, + $found, + $tests +); + +$tests = 0; + +#1 +pass("Running testssl.sh against badssl.com to create a JSON report with severity level equal greater than LOW (may take 2~3 minutes)"); $tests++; +$out = `./testssl.sh -S -e -U --jsonfile tmp.json --severity LOW --color 0 badssl.com`; +$json = json('tmp.json'); +$found = 0; +cmp_ok(@$json,'>',0,"At least 1 finding is expected"); $tests++; +foreach my $f ( @$json ) { + if ( $f->{severity} eq "INFO" ) { + $found = 1; + last; + } +} +is($found,0,"We should not have any finding with INFO level"); $tests++; + +#2 +pass("Running testssl.sh against badssl.com to create a JSON-PRETTY report with severity level equal greater than LOW (may take 2~3 minutes)"); $tests++; +$out = `./testssl.sh -S -e -U --jsonfile-pretty tmp.json --severity LOW --color 0 badssl.com`; +$json_pretty = json('tmp.json'); +$found = 0; +my $vulnerabilities = $json_pretty->{scanResult}->[0]->{vulnerabilities}; +foreach my $f ( @$vulnerabilities ) { + if ( $f->{severity} eq "INFO" ) { + $found = 1; + last; + } +} +is($found,0,"We should not have any finding with INFO level"); $tests++; + +done_testing($tests); + +sub json($) { + my $file = shift; + $file = `cat $file`; + unlink $file; + return from_json($file); +} \ No newline at end of file diff --git a/testssl.sh b/testssl.sh index 807f2fc..813e75b 100755 --- a/testssl.sh +++ b/testssl.sh @@ -875,7 +875,7 @@ fileout() { # ID, SEVERITY, FINDING, CVE, CWE, HINT local cwe="$5" local hint="$6" - if show_finding "$severity"; then + if ( "$do_pretty_json" && [[ "$1" == "service" ]] ) || show_finding "$severity"; then local finding=$(strip_lf "$(newline_to_spaces "$(strip_quote "$3")")") is_json_format && (fileout_json_finding "$1" "$severity" "$finding" "$cve" "$cwe" "$hint") From 3122b3b7b39d70d64808b43c44396c0787ea381b Mon Sep 17 00:00:00 2001 From: AlGreed Date: Thu, 9 Mar 2017 19:10:51 +0100 Subject: [PATCH 3/4] Removed mistakenly commited code. --- testssl.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/testssl.sh b/testssl.sh index 813e75b..6d53787 100755 --- a/testssl.sh +++ b/testssl.sh @@ -10238,10 +10238,7 @@ run_logjam() { len_dh_p="$((4*${#dh_p}))" debugme outln "len(dh_p): $len_dh_p | dh_p: $dh_p" echo "$dh_p" > $TEMPDIR/dh_p.txt - - DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - - if [[ ! -s "$DIR$common_primes_file" ]]; then + if [[ ! -s "$common_primes_file" ]]; then local_problem_ln "couldn't read common primes file $common_primes_file" out "${spaces}" fileout "LOGJAM_common primes" "WARN" "couldn't read common primes file $common_primes_file" From 4a6c7de3b7c3983867624c3e6b7c6d953283212e Mon Sep 17 00:00:00 2001 From: Dirk Wetter Date: Sat, 18 Mar 2017 15:07:02 +0100 Subject: [PATCH 4/4] native HTML support --- Readme.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 51904dc..d36cc62 100644 --- a/Readme.md +++ b/Readme.md @@ -59,7 +59,8 @@ Update notification here or @ [twitter](https://twitter.com/drwetter). * LUCKY13 and SWEET32 checks * LOGJAM: now checking also for known DH parameters * Check for CAA RR -* better formatting of output +* better formatting of output (indentation) +* native HTML support instead going through 'aha' * choice showing the RFC naming scheme only