From fcb8c5d0bc3b9660c48176a502bff60657d386b6 Mon Sep 17 00:00:00 2001 From: Dirk Date: Sun, 2 Aug 2015 01:16:27 +0200 Subject: [PATCH] - FIX for multiple ip addresses for one mx host (didn't expect a matroshka ;-)) - make dotted lines smaller --- testssl.sh | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/testssl.sh b/testssl.sh index 1f0032a..470263d 100755 --- a/testssl.sh +++ b/testssl.sh @@ -4097,6 +4097,7 @@ datebanner() { outln } +# one line with $1 over whole screen width draw_dotted_line() { printf -- "$1"'%.s' $(eval "echo {1.."$(($2))"}") } @@ -4117,15 +4118,23 @@ mx_all_ips() { starttls_proto="" # no starttls for Port 465, on all other ports we speak starttls pr_bold "Testing now all MX records (on port $mxport): "; outln "$mxs" for mx in $mxs; do - draw_dotted_line "-" $TERM_DWITH + draw_dotted_line "-" $(($TERM_DWITH * 2 / 3)) outln parse_hn_port "$mx:$mxport" determine_ip_addresses || continue - NODEIP="$IPADDRs" - lets_roll "${starttls_proto}" + if [[ $(printf "$IPADDRs" | wc -w | sed 's/ //g') -gt 1 ]]; then + pr_bold "Testing all IPv4 addresses (port $PORT): "; outln "$IPADDRs" + for ip in $IPADDRs; do + NODEIP="$ip" + lets_roll "${starttls_proto}" + done + else + NODEIP="$IPADDRs" + lets_roll "${starttls_proto}" + fi ret=$(($? + ret)) done - draw_dotted_line "-" $TERM_DWITH + draw_dotted_line "-" $(($TERM_DWITH * 2 / 3)) outln pr_bold "Done testing now all MX records (on port $mxport): "; outln "$mxs" else @@ -4549,10 +4558,7 @@ if $do_read_from_file; then [[ -z "$cmdline" ]] && continue [[ "$cmdline" == "EOF" ]] && break echo "$0 -q $cmdline" - draw_dotted_line "=" $TERM_DWITH - read a - #FNAME="" - #do_read_from_file=false + draw_dotted_line "=" $(($TERM_DWITH / 2)) $0 -q $cmdline done exit $? @@ -4579,13 +4585,13 @@ else if [[ $(printf "$IPADDRs" | wc -w | sed 's/ //g') -gt 1 ]]; then # we have more than one ipv4 address to check pr_bold "Testing all IPv4 addresses (port $PORT): "; outln "$IPADDRs" for ip in $IPADDRs; do - draw_dotted_line "-" $TERM_DWITH + draw_dotted_line "-" $(($TERM_DWITH / 2)) outln NODEIP="$ip" lets_roll "${STARTTLS_PROTOCOL}" ret=$(($? + ret)) done - draw_dotted_line "-" $TERM_DWITH + draw_dotted_line "-" $(($TERM_DWITH / 2)) outln pr_bold "Done testing now all IP addresses (on port $PORT): "; outln "$IPADDRs" else # we need just one ip4v to check @@ -4599,4 +4605,4 @@ fi exit $ret -# $Id: testssl.sh,v 1.331 2015/08/01 22:26:33 dirkw Exp $ +# $Id: testssl.sh,v 1.332 2015/08/01 23:16:26 dirkw Exp $