From 62db2ae6bfd99b901ecae6e5c09defde760005b2 Mon Sep 17 00:00:00 2001 From: David Cooper Date: Tue, 21 Feb 2017 13:36:23 -0500 Subject: [PATCH 1/4] Wrap long lines in display_rdns_etc() Some sites have a long list of IP addresses and some IP addresses have a long list of DNS names that map to them. This PR changes `display_rdns_etc()` to use `out_row_aligned_max_width()` to print the other IP addresses in `$IP46ADDRs` and to print `$rDNS`. --- testssl.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/testssl.sh b/testssl.sh index bfcb5dc..7365621 100755 --- a/testssl.sh +++ b/testssl.sh @@ -12176,7 +12176,7 @@ determine_service() { display_rdns_etc() { - local ip + local ip further_ip_addrs="" local nodeip="$(tr -d '[]' <<< $NODEIP)" # for displaying IPv6 addresses we don't need [] @@ -12185,14 +12185,15 @@ display_rdns_etc() { outln "$PROXYIP:$PROXYPORT " fi if [[ $(count_words "$IP46ADDRs") -gt 1 ]]; then - out " further IP addresses: $CORRECT_SPACES" + out " further IP addresses: $CORRECT_SPACES" for ip in $IP46ADDRs; do if [[ "$ip" == "$NODEIP" ]] || [[ "[$ip]" == "$NODEIP" ]]; then continue else - out " $ip" + further_ip_addrs+="$ip " fi done + out_row_aligned_max_width "$further_ip_addrs" " " $TERM_WIDTH out outln fi if "$LOCAL_A"; then @@ -12201,7 +12202,8 @@ display_rdns_etc() { outln " A record via $CORRECT_SPACES supplied IP \"$CMDLINE_IP\"" fi if [[ -n "$rDNS" ]]; then - printf " %-23s %s" "rDNS ($nodeip):" "$rDNS" + printf " %-23s %s" "rDNS ($nodeip):" + out_row_aligned_max_width "$rDNS" " " $TERM_WIDTH out fi } From c3d59b655f93fbfe1671269c360b1da973e4405e Mon Sep 17 00:00:00 2001 From: David Cooper Date: Tue, 21 Feb 2017 13:46:59 -0500 Subject: [PATCH 2/4] Add $CORRECT_SPACES to indentation --- testssl.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testssl.sh b/testssl.sh index 7365621..2784844 100755 --- a/testssl.sh +++ b/testssl.sh @@ -12193,7 +12193,7 @@ display_rdns_etc() { further_ip_addrs+="$ip " fi done - out_row_aligned_max_width "$further_ip_addrs" " " $TERM_WIDTH out + out_row_aligned_max_width "$further_ip_addrs" " $CORRECT_SPACES" $TERM_WIDTH out outln fi if "$LOCAL_A"; then @@ -12203,7 +12203,7 @@ display_rdns_etc() { fi if [[ -n "$rDNS" ]]; then printf " %-23s %s" "rDNS ($nodeip):" - out_row_aligned_max_width "$rDNS" " " $TERM_WIDTH out + out_row_aligned_max_width "$rDNS" " $CORRECT_SPACES" $TERM_WIDTH out fi } From 5aaf78cff650bc2f2ac48bfa75bcc6d003baf650 Mon Sep 17 00:00:00 2001 From: David Cooper Date: Tue, 21 Feb 2017 15:22:47 -0500 Subject: [PATCH 3/4] Fix issue #643 It seems that the head command on OS X does not accept a negative number as a value for the "-n" parameter. This PR provides an alternative method for removing the "generator: " line without using "head." --- testssl.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testssl.sh b/testssl.sh index bfcb5dc..b57664d 100755 --- a/testssl.sh +++ b/testssl.sh @@ -10218,7 +10218,7 @@ run_logjam() { # now the final test for common primes if [[ -n "$key_bitstring" ]]; then - dh_p="$($OPENSSL pkey -pubin -text -noout <<< "$key_bitstring" | awk '/prime:/,/generator:/' | tail -n +2 | head -n -1)" + dh_p="$($OPENSSL pkey -pubin -text -noout <<< "$key_bitstring" | awk '/prime:/,/generator:/' | tail -n +2 | sed -e 's/generator: .*//')" dh_p="$(strip_spaces "$(colon_to_spaces "$(newline_to_spaces "$dh_p")")")" [[ "${dh_p:0:2}" == "00" ]] && dh_p="${dh_p:2}" len_dh_p="$((4*${#dh_p}))" From 191d19be323b573c35d2451fd9673b42b0c1e792 Mon Sep 17 00:00:00 2001 From: David Cooper Date: Tue, 21 Feb 2017 15:47:59 -0500 Subject: [PATCH 4/4] Use egrep -v to remove unwanted lines --- testssl.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testssl.sh b/testssl.sh index b57664d..f7ba8df 100755 --- a/testssl.sh +++ b/testssl.sh @@ -10218,7 +10218,7 @@ run_logjam() { # now the final test for common primes if [[ -n "$key_bitstring" ]]; then - dh_p="$($OPENSSL pkey -pubin -text -noout <<< "$key_bitstring" | awk '/prime:/,/generator:/' | tail -n +2 | sed -e 's/generator: .*//')" + dh_p="$($OPENSSL pkey -pubin -text -noout <<< "$key_bitstring" | awk '/prime:/,/generator:/' | egrep -v "prime|generator")" dh_p="$(strip_spaces "$(colon_to_spaces "$(newline_to_spaces "$dh_p")")")" [[ "${dh_p:0:2}" == "00" ]] && dh_p="${dh_p:2}" len_dh_p="$((4*${#dh_p}))"