mirror of
https://github.com/drwetter/testssl.sh.git
synced 2025-09-17 09:22:54 +02:00
Formatting, early exit when HTTPS RR retruned in clear text
This commit is contained in:
23
testssl.sh
23
testssl.sh
@ -22367,6 +22367,7 @@ get_caa_rrecord() {
|
|||||||
# Service Binding and Parameter Specification via the DNS (SVCB and HTTPS Resource Records).
|
# Service Binding and Parameter Specification via the DNS (SVCB and HTTPS Resource Records).
|
||||||
# https://www.rfc-editor.org/rfc/rfc9460.html
|
# https://www.rfc-editor.org/rfc/rfc9460.html
|
||||||
# arg1: domain to check for
|
# arg1: domain to check for
|
||||||
|
# returns: string for record
|
||||||
#
|
#
|
||||||
get_https_rrecord() {
|
get_https_rrecord() {
|
||||||
local raw_https=""
|
local raw_https=""
|
||||||
@ -22408,7 +22409,13 @@ get_https_rrecord() {
|
|||||||
text_httpsrr=$(nslookup -type=HTTPS $1 | awk '/'"^${1}"'.*rdata_65// { print substr($0,index($0,$4)) }')
|
text_httpsrr=$(nslookup -type=HTTPS $1 | awk '/'"^${1}"'.*rdata_65// { print substr($0,index($0,$4)) }')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -n "$text_httpsrr" ]]; then
|
||||||
|
safe_echo "$text_httpsrr"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
# Now we need to try parsing the raw output
|
# Now we need to try parsing the raw output
|
||||||
|
# Format probably: https://www.rfc-editor.org/rfc/rfc3597 (plus updates)
|
||||||
|
|
||||||
# If there's a type65 record there are 2x3 output formats, mostly depending on age of distribution
|
# If there's a type65 record there are 2x3 output formats, mostly depending on age of distribution
|
||||||
# -- roughly that's the difference between text and binary format -- and the type of DNS client
|
# -- roughly that's the difference between text and binary format -- and the type of DNS client
|
||||||
@ -22425,14 +22432,6 @@ get_https_rrecord() {
|
|||||||
# 1) dev.testssl.sh rdata_65 = 1 . alpn="h2"
|
# 1) dev.testssl.sh rdata_65 = 1 . alpn="h2"
|
||||||
# 2) dev.testssl.sh rdata_65 = \# 10 00010000010003026832
|
# 2) dev.testssl.sh rdata_65 = \# 10 00010000010003026832
|
||||||
|
|
||||||
# we normalize the output during the following so that's e.g. 1 . alpn="h2"
|
|
||||||
|
|
||||||
# https://datatracker.ietf.org/doc/rfc9460/?include_text=1
|
|
||||||
|
|
||||||
#set -x
|
|
||||||
if [[ -n "$text_httpsrr" ]]; then
|
|
||||||
safe_echo "$text_httpsrr"
|
|
||||||
else
|
|
||||||
if "$HAS_DIG"; then
|
if "$HAS_DIG"; then
|
||||||
raw_https="$(dig $DIG_R +short +search +timeout=3 +tries=3 $noidnout type65 "$1" 2>/dev/null)"
|
raw_https="$(dig $DIG_R +short +search +timeout=3 +tries=3 $noidnout type65 "$1" 2>/dev/null)"
|
||||||
# empty if there's no such record
|
# empty if there's no such record
|
||||||
@ -22456,8 +22455,6 @@ get_https_rrecord() {
|
|||||||
fi
|
fi
|
||||||
OPENSSL_CONF="$saved_openssl_conf" # see https://github.com/drwetter/testssl.sh/issues/134
|
OPENSSL_CONF="$saved_openssl_conf" # see https://github.com/drwetter/testssl.sh/issues/134
|
||||||
|
|
||||||
# Format probably: https://www.rfc-editor.org/rfc/rfc3597 (plus updates)
|
|
||||||
|
|
||||||
# dig +short +search +timeout=3 +tries=3 +noidnout type65 dev.testssl.sh
|
# dig +short +search +timeout=3 +tries=3 +noidnout type65 dev.testssl.sh
|
||||||
# 1 . alpn="h2" port=443 ipv6hint=2a01:238:4308:a920:1000:0:b:1337
|
# 1 . alpn="h2" port=443 ipv6hint=2a01:238:4308:a920:1000:0:b:1337
|
||||||
#
|
#
|
||||||
@ -22499,14 +22496,14 @@ get_https_rrecord() {
|
|||||||
# https_property_name="$(hex2ascii ${line:4:$len_https_property})"
|
# https_property_name="$(hex2ascii ${line:4:$len_https_property})"
|
||||||
# https_property_value="$(hex2ascii "${line:$((4+len_https_property)):100}")"
|
# https_property_value="$(hex2ascii "${line:$((4+len_https_property)):100}")"
|
||||||
else
|
else
|
||||||
outln "please report unknown HTTPS RR $line with flag @ $NODE"
|
out "please report unknown HTTPS RR $line with flag @ $NODE"
|
||||||
return 7
|
return 7
|
||||||
fi
|
fi
|
||||||
done <<< "$raw_https"
|
done <<< "$raw_https"
|
||||||
else
|
else
|
||||||
safe_echo "$raw_https"
|
safe_echo "$raw_https"
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
#set +x
|
#set +x
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
@ -23343,7 +23340,7 @@ dns_https_rr () {
|
|||||||
else
|
else
|
||||||
https_rr="$(get_https_rrecord $NODE)"
|
https_rr="$(get_https_rrecord $NODE)"
|
||||||
if [[ -n "$https_rr" ]]; then
|
if [[ -n "$https_rr" ]]; then
|
||||||
pr_svrty_good "yes" ; out " "
|
pr_svrty_good "yes" ; out ": "
|
||||||
prln_italic "$(out_row_aligned_max_width "$https_rr" "$indent " $TERM_WIDTH)"
|
prln_italic "$(out_row_aligned_max_width "$https_rr" "$indent " $TERM_WIDTH)"
|
||||||
fileout "${jsonID}" "OK" "$https_rr"
|
fileout "${jsonID}" "OK" "$https_rr"
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user