diff --git a/testssl.sh b/testssl.sh
index 4697baa..44cf79f 100755
--- a/testssl.sh
+++ b/testssl.sh
@@ -742,7 +742,7 @@ pr_url() { tm_out "$1"; html_out "$1"; }
### color switcher (see e.g. https://linuxtidbits.wordpress.com/2008/08/11/output-color-on-bash-scripts/
-### http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x405.html
+### http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x405.html
set_color_functions() {
local ncurses_tput=true
@@ -845,7 +845,7 @@ fileout_section_header() {
"$do_pretty_json" && FIRST_FINDING=true && (printf "%s%s\n" "$str" "$(fileout_json_section "$1")") >> "$JSONFILE"
}
-fileout_section_footer() {
+fileout_section_footer() {
"$do_pretty_json" && printf "\n ]" >> "$JSONFILE"
"$do_pretty_json" && "$1" && echo -e "\n }" >> "$JSONFILE"
}
@@ -1072,7 +1072,7 @@ csv_header() {
html_header() {
local fname_prefix
local filename_provided=false
-
+
[[ -n "$HTMLFILE" ]] && [[ ! -d "$HTMLFILE" ]] && filename_provided=true
# Don't create HTML headers and footers in the following scenarios:
@@ -1146,8 +1146,8 @@ if [[ $(uname) == "Linux" ]] ; then
toupper() { echo -n "${1^^}" ; }
tolower() { echo -n "${1,,}" ; }
else
- toupper() { echo -n "$1" | tr 'a-z' 'A-Z'; }
- tolower() { echo -n "$1" | tr 'A-Z' 'a-z' ; }
+ toupper() { tr 'a-z' 'A-Z' <<< "$1"; }
+ tolower() { tr 'A-Z' 'a-z' <<< "$1"; }
fi
debugme() {
@@ -1181,7 +1181,7 @@ count_words() {
}
count_ciphers() {
- echo -n "$1" | sed 's/:/ /g' | wc -w | sed 's/ //g'
+ echo $(wc -w <<< "${1//:/ }")
}
actually_supported_ciphers() {
@@ -1476,7 +1476,6 @@ service_detection() {
head $TMPFILE | egrep -aqw "Jive News|InterNetNews|NNRP|INN" && SERVICE=NNTP
debugme head -50 $TMPFILE
fi
-# FIXME: we can guess ports by port number if not properly recognized (and label it as guessed)
out " Service detected: $CORRECT_SPACES"
case $SERVICE in
@@ -2494,7 +2493,7 @@ std_cipherlists() {
;;
esac
tmpfile_handle $FUNCNAME.$debugname.txt
- [[ $DEBUG -ge 1 ]] && outln " -- $1" || outln #FIXME: should be in standard output at some time
+ [[ $DEBUG -ge 1 ]] && tmln_out " -- $1" || tmln_out
else
singlespaces=$(sed -e 's/ \+/ /g' -e 's/^ //' -e 's/ $//g' -e 's/ //g' <<< "$2")
if [[ "$OPTIMAL_PROTO" == "-ssl2" ]]; then
@@ -10155,7 +10154,7 @@ run_beast(){
fi
else
if ! "$vuln_beast" ; then
- prln_done_good " no CBC ciphers for $(toupper $proto) (OK)"
+ prln_done_good "no CBC ciphers for $(toupper $proto) (OK)"
fileout "cbc_$proto" "OK" "BEAST: No CBC ciphers for $(toupper $proto)" "$cve" "$cwe"
fi
fi
@@ -10862,7 +10861,7 @@ EOF
}
maketempf() {
- TEMPDIR=$(mktemp -d /tmp/ssltester.XXXXXX) || exit -6
+ TEMPDIR=$(mktemp -d /tmp/testssl.XXXXXX) || exit -6
TMPFILE=$TEMPDIR/tempfile.txt || exit -6
if [[ "$DEBUG" -eq 0 ]]; then
ERRFILE="/dev/null"
@@ -10999,7 +10998,7 @@ mybanner() {
bb1=$(cat <$LOGFILE &
+ # first=false
sleep $PARALLEL_SLEEP
done < "$FNAME"
return $?
}
-run_mass_testing() {
- local cmdline=""
- local first=true
- local global_cmdline=${CMDLINE%%--file*}
-
- if [[ ! -r "$FNAME" ]] && "$IKNOW_FNAME"; then
- fatal "Can't read file \"$FNAME\"" "2"
- fi
-
- pr_reverse "====== Running in file batch mode with file=\"$FNAME\" ======"; outln "\n"
- while read cmdline; do
- cmdline=$(filter_input "$cmdline")
- [[ -z "$cmdline" ]] && continue
- [[ "$cmdline" == "EOF" ]] && break
- cmdline="$0 $global_cmdline --warnings=batch $cmdline"
- draw_line "=" $((TERM_WIDTH / 2)); outln;
- outln "$cmdline"
- "$first" || fileout_separator
- CHILD_MASS_TESTING=true $cmdline
- first=false
- done < "${FNAME}"
- return $?
-}
-
-
# This initializes boolean global do_* variables. They keep track of what to do
# -- as the name insinuates
@@ -12490,9 +12490,6 @@ ip=""
lets_roll init
initialize_globals
parse_cmd_line "$@"
-json_header
-csv_header
-html_header
get_install_dir
set_color_functions
maketempf
@@ -12503,6 +12500,9 @@ mybanner
check_proxy
check4openssl_oldfarts
check_bsd_mount
+json_header
+csv_header
+html_header
if "$do_display_only"; then
prettyprint_local "$PATTERN2SHOW"