@@ -912,14 +912,19 @@ fileout_insert_warning() {
912912 [[ "$CMDLINE=" =~ -iL ]] && return 0
913913 # Note we still have the message on screen + in HTML which is not as optimal as it could be
914914
915- if "$do_pretty_json"; then
915+ if "$do_pretty_json" && "$JSONHEADER" ; then
916916 echo -e " \"clientProblem${CLIENT_PROB_NO}\" : [" >>"$JSONFILE"
917917 CLIENT_PROB_NO=$((CLIENT_PROB_NO + 1))
918918 FIRST_FINDING=true # make sure we don't have a comma here
919919 fi
920920 fileout "$1" "$2" "$3"
921921 if "$do_pretty_json"; then
922- echo -e "\n ]," >>"$JSONFILE"
922+ if "$JSONHEADER"; then
923+ echo -e "\n ]," >>"$JSONFILE"
924+ else
925+ echo -e ", " >>"$JSONFILE"
926+ fi
927+ FIRST_FINDING=true
923928 fi
924929}
925930
@@ -18535,6 +18540,7 @@ determine_optimal_proto() {
1853518540 local all_failed=true
1853618541 local tmp=""
1853718542 local proto optimal_proto
18543+ local jsonID="optimal_proto"
1853818544
1853918545 "$do_tls_sockets" && return 0
1854018546
@@ -18601,13 +18607,15 @@ determine_optimal_proto() {
1860118607
1860218608 if [[ "$optimal_proto" == -ssl2 ]]; then
1860318609 prln_magenta "$NODEIP:$PORT appears to only support SSLv2."
18610+ fileout "$jsonID" "WARN" "$NODEIP:$PORT appears to only support SSLv2."
1860418611 ignore_no_or_lame " Type \"yes\" to proceed and accept false negatives or positives" "yes"
1860518612 [[ $? -ne 0 ]] && exit $ERR_CLUELESS
1860618613 elif "$all_failed" && ! "$ALL_FAILED_SOCKETS"; then
1860718614 if ! "$HAS_TLS13" && "$TLS13_ONLY"; then
1860818615 pr_magenta " $NODE:$PORT appears to support TLS 1.3 ONLY. You better use --openssl=<path_to_openssl_supporting_TLS_1.3>"
1860918616 if ! "$OSSL_SHORTCUT" || [[ ! -x /usr/bin/openssl ]] || /usr/bin/openssl s_client -tls1_3 2>&1 | grep -aiq "unknown option"; then
1861018617 outln
18618+ fileout "$jsonID" "WARN" "$NODE:$PORT appears to support TLS 1.3 ONLY, but $OPENSSL does not support TLS 1.3"
1861118619 ignore_no_or_lame " Type \"yes\" to proceed and accept all scan problems" "yes"
1861218620 [[ $? -ne 0 ]] && exit $ERR_CLUELESS
1861318621 MAX_OSSL_FAIL=10
@@ -18624,20 +18632,24 @@ determine_optimal_proto() {
1862418632 [[ "$(has_server_protocol "tls1_2")" -ne 0 ]] && [[ "$(has_server_protocol "tls1_1")" -ne 0 ]] &&
1862518633 [[ "$(has_server_protocol "tls1")" -ne 0 ]]; then
1862618634 prln_magenta " $NODE:$PORT appears to support SSLv3 ONLY. You better use --openssl=<path_to_openssl_supporting_SSL_3>"
18635+ fileout "$jsonID" "WARN" "$NODE:$PORT appears to support SSLv3 ONLY, but $OPENSSL does not support SSLv3."
1862718636 ignore_no_or_lame " Type \"yes\" to proceed and accept all scan problems" "yes"
1862818637 [[ $? -ne 0 ]] && exit $ERR_CLUELESS
1862918638 MAX_OSSL_FAIL=10
1863018639 else
1863118640 prln_bold " Your OpenSSL cannot connect to $NODEIP:$PORT"
18641+ fileout "$jsonID" "WARN" "Your OpenSSL cannot connect to $NODEIP:$PORT."
1863218642 ignore_no_or_lame " The results might look ok but they could be nonsense. Really proceed ? (\"yes\" to continue)" "yes"
1863318643 [[ $? -ne 0 ]] && exit $ERR_CLUELESS
1863418644 fi
1863518645 elif "$all_failed"; then
1863618646 outln
1863718647 if "$HAS_IPv6"; then
1863818648 pr_bold " Your $OPENSSL is not IPv6 aware, or $NODEIP:$PORT "
18649+ fileout "$jsonID" "WARN" "Your $OPENSSL is not IPv6 aware, or $NODEIP:$PORT doesn't seem to be a TLS/SSL enabled server."
1863918650 else
1864018651 pr_bold " $NODEIP:$PORT "
18652+ fileout "$jsonID" "WARN" "$NODEIP:$PORT doesn't seem to be a TLS/SSL enabled server."
1864118653 fi
1864218654 tmpfile_handle ${FUNCNAME[0]}.txt
1864318655 prln_bold "doesn't seem to be a TLS/SSL enabled server";
@@ -18649,6 +18661,7 @@ determine_optimal_proto() {
1864918661 # FIXME: Should we include some sort of "please report" note here?
1865018662 prln_magenta " Testing with $NODE:$PORT only worked using $OPENSSL."
1865118663 prln_magenta " Test results may be somewhat better if the --ssl-native option is used."
18664+ fileout "$jsonID" "WARN" "Testing with $NODE:$PORT only worked using $OPENSSL."
1865218665 ignore_no_or_lame " Type \"yes\" to proceed and accept false negatives or positives" "yes"
1865318666 [[ $? -ne 0 ]] && exit $ERR_CLUELESS
1865418667 fi
0 commit comments