Merge pull request #3147 from testssl/issue_cmdline_warnings_3.2

Introduce early warning function (3.2)
This commit is contained in:
Dirk Wetter
2026-09-16 17:49:07 +02:00
committed by GitHub
+31 -4
View File
@@ -24848,9 +24848,6 @@ parse_cmd_line() {
fi fi
fi fi
"$FAST" && pr_warning "\n'--fast' can have some undesired side effects thus it is not recommended to use anymore\n"
"$SSL_NATIVE" && pr_warning "\nusage of '--ssl-native' is not recommended as it will return incomplete and may even return incorrect results\n"
if "$do_starttls_injection" && [[ "$STARTTLS_PROTOCOL" =~ smtp ]]; then if "$do_starttls_injection" && [[ "$STARTTLS_PROTOCOL" =~ smtp ]]; then
((VULN_COUNT++)) ((VULN_COUNT++))
fi fi
@@ -24867,8 +24864,38 @@ parse_cmd_line() {
fi fi
CMDLINE_PARSED=true CMDLINE_PARSED=true
# This function is amended later w issue_cmdline_warnings() when fileout() functions, specifically
# the pre-fileout function fileout_insert_warning(), work. Here we only can use fatal_cmd_line().
} }
# This serves as a warning function when the user does something which is not recommended. Parts
# of that have been handled in parse_cmd_line(), however that was too early for warning messages
# which also need to go into files.
#
issue_cmdline_warnings() {
local tmp=""
local avoid_complaints="^(1\.1\.1\.1|1\.0\.0\.1|8\.8\.8\.8|8\.8\.4\.4|9\.9\.9\.9)$"
# yeah, I know there are more. But these are the most common where we avoid warnings
if "$FAST" ; then
outln
prln_warning "'--fast' can have some undesired side effects thus it is not recommended to use anymore"
fileout_insert_warning "cmdline_fast_depreciation" "WARN" "'--fast' can have some undesired side effects thus it is not recommended to use anymore"
fi
if "$SSL_NATIVE"; then
outln
prln_warning "usage of '--ssl-native' is not recommended as it will return incomplete and maybe even incorrect results"
fileout_insert_warning "cmdline_ssl-native" "WARN" "Usage of '--ssl-native' is not recommended as it will return incomplete and maybe even incorrect results"
fi
tmp=${URI#*//} # remove https:// and (future) friends
if [[ ! $tmp =~ [a-zA-Z] ]] && [[ ! $tmp =~ $avoid_complaints ]]; then
# No letters indicate it's not a name
prln_warning " Warning: Target is not a server name: results may be completely wrong, at minimum trust may show false results."
fileout_insert_warning "cmdline_ip-target" "WARN" "Target is not a server name: results may be completely wrong, at minimum trust may show false results."
fi
}
# connect call from openssl needs ipv6 in square brackets # connect call from openssl needs ipv6 in square brackets
nodeip_to_proper_ip6() { nodeip_to_proper_ip6() {
@@ -25085,7 +25112,6 @@ lets_roll() {
} }
################# main ################# ################# main #################
@@ -25113,6 +25139,7 @@ lets_roll() {
maketempf maketempf
find_openssl_binary find_openssl_binary
find_socat find_socat
issue_cmdline_warnings
choose_printf choose_printf
check_resolver_bins check_resolver_bins
prepare_debug ; stopwatch parse prepare_debug ; stopwatch parse