From b8f770dbe3175df1f23d4bda0552b2f4a2c186c8 Mon Sep 17 00:00:00 2001 From: vsbs-david <142800323+vsbs-david@users.noreply.github.com> Date: Tue, 10 Oct 2023 09:05:48 +0200 Subject: [PATCH] Added drill command to get_a[aaa]_record() for local hostname --- testssl.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/testssl.sh b/testssl.sh index 4b3257e..a588a1b 100755 --- a/testssl.sh +++ b/testssl.sh @@ -21090,8 +21090,10 @@ get_a_record() { ip4=$(filter_ip4_address $(avahi-resolve -4 -n "$1" 2>/dev/null | awk '{ print $2 }')) elif "$HAS_DIG"; then ip4=$(filter_ip4_address $(dig $DIG_R @224.0.0.251 -p 5353 +short -t a +notcp "$1" 2>/dev/null | sed '/^;;/d')) + elif "$HAS_DRILL"; then + ip4=$(filter_ip4_address $(drill @224.0.0.251 -p 5353 "$1" | awk '/ANSWER SECTION/,/AUTHORITY SECTION/ { print $NF }' | awk '/^[0-9]/')) else - fatal "Local hostname given but no 'avahi-resolve' or 'dig' available." $ERR_DNSBIN + fatal "Local hostname given but neither 'avahi-resolve', 'dig' or 'drill' is available." $ERR_DNSBIN fi fi if [[ -z "$ip4" ]] && "$HAS_DIG"; then @@ -21134,8 +21136,10 @@ get_aaaa_record() { ip6=$(filter_ip6_address $(avahi-resolve -6 -n "$1" 2>/dev/null | awk '{ print $2 }')) elif "$HAS_DIG"; then ip6=$(filter_ip6_address $(dig $DIG_R @ff02::fb -p 5353 -t aaaa +short +notcp "$NODE")) + elif "$HAS_DRILL"; then + ip6=$(filter_ip6_address $(drill @ff02::fb -p 5353 "$1" | awk '/ANSWER SECTION/,/AUTHORITY SECTION/ { print $NF }' | awk '/^[0-9]/')) else - fatal "Local hostname given but no 'avahi-resolve' or 'dig' available." $ERR_DNSBIN + fatal "Local hostname given but neither 'avahi-resolve', 'dig' or 'drill' is available." $ERR_DNSBIN fi elif "$HAS_DIG"; then ip6=$(filter_ip6_address $(dig +search $DIG_R +short +timeout=2 +tries=2 $noidnout -t aaaa "$1" 2>/dev/null | awk '/^[0-9]/ { print $1 }'))