Skip to content

Commit 581788f

Browse files
committed
Merge branch '3.1dev' of https://github.com/w4ntun/testssl.sh into w4ntun-3.1dev
2 parents 88763f4 + 0af73c2 commit 581788f

1 file changed

Lines changed: 36 additions & 26 deletions

File tree

testssl.sh

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ TESTSSL_INSTALL_DIR="${TESTSSL_INSTALL_DIR:-""}" # If you run testssl.sh and it
196196
CA_BUNDLES_PATH="${CA_BUNDLES_PATH:-""}" # You can have your CA stores some place else
197197
EXPERIMENTAL=${EXPERIMENTAL:-false} # a development hook which allows us to disable code
198198
PROXY_WAIT=${PROXY_WAIT:-20} # waiting at max 20 seconds for socket reply through proxy
199-
DNS_VIA_PROXY=${DNS_VIA_PROXY:-true} # do DNS lookups via proxy. --ip=proxy reverses this
199+
DNS_VIA_PROXY=${DNS_VIA_PROXY:-false} # do DNS lookups via proxy. --ip=proxy reverses this
200200
IGN_OCSP_PROXY=${IGN_OCSP_PROXY:-false} # Also when --proxy is supplied it is ignored when testing for revocation via OCSP via --phone-out
201201
HEADER_MAXSLEEP=${HEADER_MAXSLEEP:-5} # we wait this long before killing the process to retrieve a service banner / http header
202202
MAX_SOCKET_FAIL=${MAX_SOCKET_FAIL:-2} # If this many failures for TCP socket connects are reached we terminate
@@ -22040,12 +22040,19 @@ display_rdns_etc() {
2204022040

2204122041
datebanner() {
2204222042
local scan_time_f=""
22043-
22043+
local node_banner=""
22044+
22045+
if [[ -n "PROXY" ]] && $DNS_VIA_PROXY;then
22046+
node_banner="$NODE:$PORT"
22047+
else
22048+
node_banner="$NODEIP:$PORT ($NODE)"
22049+
fi
22050+
2204422051
if [[ "$1" =~ Done ]] ; then
2204522052
scan_time_f="$(printf "%04ss" "$SCAN_TIME")" # 4 digits because of windows
22046-
pr_reverse "$1 $(date +%F) $(date +%T) [$scan_time_f] -->> $NODEIP:$PORT ($NODE) <<--"
22053+
pr_reverse "$1 $(date +%F) $(date +%T) [$scan_time_f] -->> $node_banner <<--"
2204722054
else
22048-
pr_reverse "$1 $(date +%F) $(date +%T) -->> $NODEIP:$PORT ($NODE) <<--"
22055+
pr_reverse "$1 $(date +%F) $(date +%T) -->> $node_banner <<--"
2204922056
fi
2205022057
outln "\n"
2205122058
[[ "$1" =~ Start ]] && display_rdns_etc
@@ -23761,7 +23768,6 @@ lets_roll() {
2376123768
fi
2376223769
stopwatch initialized
2376323770

23764-
[[ -z "$NODEIP" ]] && fatal "$NODE doesn't resolve to an IP address" $ERR_DNSLOOKUP
2376523771
nodeip_to_proper_ip6
2376623772
reset_hostdepended_vars
2376723773
determine_rdns # Returns always zero or has already exited if fatal error occurred
@@ -23964,26 +23970,30 @@ lets_roll() {
2396423970
[[ -z "$NODE" ]] && parse_hn_port "${URI}" # NODE, URL_PATH, PORT, IPADDRs and IP46ADDR is set now
2396523971
prepare_logging
2396623972

23967-
if ! determine_ip_addresses; then
23968-
fatal "No IP address could be determined" $ERR_DNSLOOKUP
23969-
fi
23970-
if [[ $(count_words "$IPADDRs") -gt 1 ]]; then # we have more than one ipv4 address to check
23971-
MULTIPLE_CHECKS=true
23972-
pr_bold "Testing all IPv4 addresses (port $PORT): "; outln "$IPADDRs"
23973-
for ip in $IPADDRs; do
23974-
draw_line "-" $((TERM_WIDTH * 2 / 3))
23975-
outln
23976-
NODEIP="$ip"
23977-
lets_roll "${STARTTLS_PROTOCOL}"
23978-
RET=$((RET + $?)) # RET value per IP address
23979-
done
23980-
draw_line "-" $((TERM_WIDTH * 2 / 3))
23981-
outln
23982-
pr_bold "Done testing now all IP addresses (on port $PORT): "; outln "$IPADDRs"
23983-
else # Just 1x ip4v to check, applies also if CMDLINE_IP was supplied
23984-
NODEIP="$IPADDRs"
23985-
lets_roll "${STARTTLS_PROTOCOL}"
23986-
RET=$?
23987-
fi
23973+
if [[ -n "$PROXY" ]] && $DNS_VIA_PROXY; then
23974+
NODEIP="$NODE"
23975+
lets_roll "${STARTTLS_PROTOCOL}"
23976+
RET=$?
23977+
else
23978+
determine_ip_addresses
23979+
if [[ $(count_words "$IPADDRs") -gt 1 ]]; then # we have more than one ipv4 address to check
23980+
MULTIPLE_CHECKS=true
23981+
pr_bold "Testing all IPv4 addresses (port $PORT): "; outln "$IPADDRs"
23982+
for ip in $IPADDRs; do
23983+
draw_line "-" $((TERM_WIDTH * 2 / 3))
23984+
outln
23985+
NODEIP="$ip"
23986+
lets_roll "${STARTTLS_PROTOCOL}"
23987+
RET=$((RET + $?)) # RET value per IP address
23988+
done
23989+
draw_line "-" $((TERM_WIDTH * 2 / 3))
23990+
outln
23991+
pr_bold "Done testing now all IP addresses (on port $PORT): "; outln "$IPADDRs"
23992+
else # Just 1x ip4v to check, applies also if CMDLINE_IP was supplied
23993+
NODEIP="$IPADDRs"
23994+
lets_roll "${STARTTLS_PROTOCOL}"
23995+
RET=$?
23996+
fi
23997+
fi
2398823998

2398923999
exit $RET

0 commit comments

Comments
 (0)