mirror of
https://github.com/drwetter/testssl.sh.git
synced 2025-01-01 06:19:44 +01:00
- BUGFIX: supplying ip addresses only works again
This commit is contained in:
parent
e117fd9612
commit
723ab08258
56
testssl.sh
56
testssl.sh
@ -1628,34 +1628,40 @@ parse_hn_port() {
|
|||||||
|
|
||||||
|
|
||||||
get_dns_entries() {
|
get_dns_entries() {
|
||||||
# for security testing sometimes we have local host entries, so getent is preferred
|
test4iponly=`printf $NODE | sed -e 's/[0-9]//g' -e 's/\.//g'`
|
||||||
if which getent 2>&1 >/dev/null ; then
|
if [ "x$test4iponly" == "x" ]; then # only an IPv4 address was supplied
|
||||||
getent ahostsv4 $NODE 2>/dev/null >/dev/null
|
IP4=$NODE
|
||||||
if [ $? -eq 0 ]; then
|
SNI="" # override this as we test the IP only
|
||||||
# Linux, no BSD
|
else
|
||||||
key2get=ahostsv4
|
# for security testing sometimes we have local host entries, so getent is preferred
|
||||||
else
|
if which getent 2>&1 >/dev/null ; then
|
||||||
key2get=hosts
|
getent ahostsv4 $NODE 2>/dev/null >/dev/null
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
# Linux, no BSD
|
||||||
|
key2get=ahostsv4
|
||||||
|
else
|
||||||
|
key2get=hosts
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
IP4=`getent $key2get $NODE &>/dev/null | grep $NODE | grep -v ':' | awk '{ print $1}' | uniq`
|
||||||
IP4=`getent $key2get $NODE &>/dev/null | grep $NODE | grep -v ':' | awk '{ print $1}' | uniq`
|
# getent returned nothing:
|
||||||
# getent returned nothing:
|
if [ -z "$IP4" ] ; then
|
||||||
if [ -z "$IP4" ] ; then
|
IP4=`host -t a $NODE | grep -v alias | sed 's/^.*address //'`
|
||||||
IP4=`host -t a $NODE | grep -v alias | sed 's/^.*address //'`
|
if echo "$IP4" | grep -q NXDOMAIN ; then
|
||||||
if echo "$IP4" | grep -q NXDOMAIN ; then
|
magenta "Can't proceed: No IP resultion from \"$NODE\""; outln "\n"
|
||||||
magenta "Can't proceed: No IP resultion from \"$NODE\""; outln "\n"
|
exit 1
|
||||||
exit 1
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# for IPv6 we often get this :ffff:IPV4 address which isn't of any use
|
# for IPv6 we often get this :ffff:IPV4 address which isn't of any use
|
||||||
#which getent 2>&1 >/dev/null && IP6=`getent ahostsv6 $NODE | grep $NODE | awk '{ print $1}' | grep -v '::ffff' | uniq`
|
#which getent 2>&1 >/dev/null && IP6=`getent ahostsv6 $NODE | grep $NODE | awk '{ print $1}' | grep -v '::ffff' | uniq`
|
||||||
|
|
||||||
if [ -z "$IP6" ] ; then
|
if [ -z "$IP6" ] ; then
|
||||||
if host -t aaaa $NODE 2>&1 >/dev/null ; then
|
if host -t aaaa $NODE 2>&1 >/dev/null ; then
|
||||||
IP6=`host -t aaaa $NODE | grep -v alias | grep -v "no AAAA record" | sed 's/^.*address //'`
|
IP6=`host -t aaaa $NODE | grep -v alias | grep -v "no AAAA record" | sed 's/^.*address //'`
|
||||||
else
|
else
|
||||||
IP6=""
|
IP6=""
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -1878,7 +1884,7 @@ case "$1" in
|
|||||||
exit $ret ;;
|
exit $ret ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# $Id: testssl.sh,v 1.116 2014/09/24 09:29:05 dirkw Exp $
|
# $Id: testssl.sh,v 1.118 2014/10/07 09:12:53 dirkw Exp $
|
||||||
# vim:ts=5:sw=5
|
# vim:ts=5:sw=5
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user