mirror of
https://github.com/drwetter/testssl.sh.git
synced 2025-01-03 23:39:45 +01:00
polishing #628, mostly make sure we automatically align to terminal width
This commit is contained in:
parent
21cd97b08a
commit
7d6f1eb46f
21
testssl.sh
21
testssl.sh
@ -987,6 +987,7 @@ out_row_aligned_max_width() {
|
||||
local cr=$'\n'
|
||||
local line entry first=true last=false
|
||||
|
||||
max_width=$max_width-1 # at the moment we align to terminal width. This makes sure we don't wrap too late
|
||||
max_width=$max_width-${#spaces}
|
||||
len=${#text}
|
||||
while true; do
|
||||
@ -1027,7 +1028,7 @@ out_row_aligned_max_width() {
|
||||
fi
|
||||
while read entry; do
|
||||
$print_function "$entry" ; out " "
|
||||
done <<< "$(echo "$line" | tr ' ' '\n')"
|
||||
done <<< "$(tr ' ' '\n' <<< "$line")"
|
||||
"$last" && break
|
||||
done
|
||||
return 0
|
||||
@ -5260,7 +5261,7 @@ cipher_pref_check() {
|
||||
if [[ -n "$order" ]]; then
|
||||
outln
|
||||
printf " %-10s" "$proto: "
|
||||
out_row_aligned_max_width "$order" " " 120 out
|
||||
out_row_aligned_max_width "$order" " " $TERM_WIDTH out
|
||||
fileout "order_$p" "INFO" "Default cipher order for protocol $p: $order"
|
||||
fi
|
||||
done
|
||||
@ -5286,7 +5287,7 @@ cipher_pref_check() {
|
||||
order+=" $cipher"
|
||||
done
|
||||
fi
|
||||
out_row_aligned_max_width "$order" " " 120 out
|
||||
out_row_aligned_max_width "$order" " " $TERM_WIDTH out
|
||||
outln
|
||||
[[ -n $order ]] && fileout "order_spdy_$p" "INFO" "Default cipher order for SPDY protocol $p: $order"
|
||||
done
|
||||
@ -6125,7 +6126,7 @@ certificate_info() {
|
||||
while read san; do
|
||||
[[ -n "$san" ]] && all_san+="$san "
|
||||
done <<< "$sans"
|
||||
out_row_aligned_max_width "$all_san" "$indent " 120 pr_italic
|
||||
out_row_aligned_max_width "$all_san" "$indent " $TERM_WIDTH pr_italic
|
||||
fileout "${json_prefix}san" "INFO" "subjectAltName (SAN) : $all_san"
|
||||
else
|
||||
out "-- "
|
||||
@ -6554,7 +6555,7 @@ run_server_defaults() {
|
||||
fileout "tls_extensions" "INFO" "TLS server extensions (std): (none)"
|
||||
else
|
||||
#FIXME: we rather want to have the chance to print each ext in italcs or another format. Atm is a string of quoted strings -- that needs to be fixed at the root
|
||||
out_row_aligned_max_width "$TLS_EXTENSIONS" " " 120 out; outln
|
||||
out_row_aligned_max_width "$TLS_EXTENSIONS" " " $TERM_WIDTH out; outln
|
||||
fileout "tls_extensions" "INFO" "TLS server extensions (std): $TLS_EXTENSIONS"
|
||||
fi
|
||||
|
||||
@ -6779,7 +6780,7 @@ run_pfs() {
|
||||
outln "${sigalg[i]}"
|
||||
fi
|
||||
done
|
||||
! "$WIDE" && out_row_aligned_max_width "$pfs_ciphers" " " 120 out
|
||||
! "$WIDE" && out_row_aligned_max_width "$pfs_ciphers" " " $TERM_WIDTH out
|
||||
debugme echo $pfs_offered
|
||||
"$WIDE" || outln
|
||||
fileout "pfs_ciphers" "INFO" "(Perfect) Forward Secrecy Ciphers: $pfs_ciphers"
|
||||
@ -6860,7 +6861,7 @@ run_pfs() {
|
||||
if [[ -n "$curves_offered" ]]; then
|
||||
"$WIDE" && outln
|
||||
pr_bold " Elliptic curves offered: "
|
||||
out_row_aligned_max_width "$curves_offered" " " 120 pr_ecdh_curve_quality
|
||||
out_row_aligned_max_width "$curves_offered" " " $TERM_WIDTH pr_ecdh_curve_quality
|
||||
outln
|
||||
fileout "ecdhe_curves" "INFO" "Elliptic curves offered $curves_offered"
|
||||
fi
|
||||
@ -10402,8 +10403,8 @@ run_beast(){
|
||||
! "$first" && out "$spaces"
|
||||
out "$(toupper $proto):"
|
||||
[[ -n "$higher_proto_supported" ]] && \
|
||||
out_row_aligned_max_width "$detected_cbc_ciphers" " " 120 pr_svrty_low || \
|
||||
out_row_aligned_max_width "$detected_cbc_ciphers" " " 120 pr_svrty_medium
|
||||
out_row_aligned_max_width "$detected_cbc_ciphers" " " $TERM_WIDTH pr_svrty_low || \
|
||||
out_row_aligned_max_width "$detected_cbc_ciphers" " " $TERM_WIDTH pr_svrty_medium
|
||||
outln
|
||||
detected_cbc_ciphers="" # empty for next round
|
||||
first=false
|
||||
@ -10733,7 +10734,7 @@ run_rc4() {
|
||||
fi
|
||||
"${ciphers_found[i]}" && rc4_detected+="${ciph[i]} "
|
||||
done
|
||||
! "$WIDE" && out_row_aligned_max_width "$rc4_detected" " " 120 pr_svrty_high
|
||||
! "$WIDE" && out_row_aligned_max_width "$rc4_detected" " " $TERM_WIDTH pr_svrty_high
|
||||
outln
|
||||
"$WIDE" && pr_svrty_high "VULNERABLE (NOT ok)"
|
||||
fileout "rc4" "HIGH" "RC4: VULNERABLE, Detected ciphers: $rc4_detected" "$cve" "$cwe" "$hint"
|
||||
|
Loading…
Reference in New Issue
Block a user