mirror of
https://github.com/drwetter/testssl.sh.git
synced 2024-12-27 11:59:45 +01:00
Merge pull request #2237 from a1346054/which
Use bash-builtin `command -v` instead of external `which`
This commit is contained in:
commit
de48956639
@ -74,7 +74,7 @@ datebanner() {
|
||||
|
||||
dns() {
|
||||
ip4=`host -t a $1 | grep -v alias | sed 's/^.*address //'`
|
||||
which getent 2>&1 >/dev/null && getent ahostsv4 $1 2>&1 >/dev/null && ip4=`getent ahostsv4 $1 | awk '{ print $1}' | uniq`
|
||||
command -v getent 2>&1 >/dev/null && getent ahostsv4 $1 2>&1 >/dev/null && ip4=`getent ahostsv4 $1 | awk '{ print $1}' | uniq`
|
||||
NODEIP=`echo "$ip4" | head -1`
|
||||
rDNS=`host -t PTR $NODEIP | sed -e 's/^.*pointer //' -e 's/\.$//'`
|
||||
echo $rDNS | grep -q NXDOMAIN && rDNS=""
|
||||
|
@ -36,7 +36,7 @@ find_openssl_binary() {
|
||||
: # 2. otherwise try openssl in path of testssl.sh
|
||||
elif test_openssl_suffix ../$RUN_DIR/bin; then
|
||||
: # 3. otherwise here, this is supposed to be the standard --platform independent path in the future!!!
|
||||
elif test_openssl_suffix "$(dirname "$(which openssl)")"; then
|
||||
elif test_openssl_suffix "$(dirname "$(command -v openssl)")"; then
|
||||
: # 5. we tried hard and failed, so now we use the system binaries
|
||||
fi
|
||||
|
||||
|
@ -67,7 +67,7 @@ get_mapping_file() {
|
||||
fi
|
||||
|
||||
# we haven't found the cipher file yet...
|
||||
if [[ ! -r "$CIPHERS_BY_STRENGTH_FILE" ]] && which readlink &>/dev/null ; then
|
||||
if [[ ! -r "$CIPHERS_BY_STRENGTH_FILE" ]] && command -v readlink &>/dev/null ; then
|
||||
readlink -f ls &>/dev/null && \
|
||||
TESTSSL_INSTALL_DIR=$(readlink -f $(basename ${BASH_SOURCE[0]})) || \
|
||||
TESTSSL_INSTALL_DIR=$(readlink $(basename ${BASH_SOURCE[0]}))
|
||||
@ -78,14 +78,14 @@ get_mapping_file() {
|
||||
fi
|
||||
|
||||
# still no cipher mapping file:
|
||||
if [[ ! -r "$CIPHERS_BY_STRENGTH_FILE" ]] && which realpath &>/dev/null ; then
|
||||
if [[ ! -r "$CIPHERS_BY_STRENGTH_FILE" ]] && command -v realpath &>/dev/null ; then
|
||||
TESTSSL_INSTALL_DIR=$(dirname $(realpath ${BASH_SOURCE[0]}))
|
||||
CIPHERS_BY_STRENGTH_FILE="$TESTSSL_INSTALL_DIR/etc/cipher-mapping.txt"
|
||||
[[ -r "$TESTSSL_INSTALL_DIR/cipher-mapping.txt" ]] && CIPHERS_BY_STRENGTH_FILE="$TESTSSL_INSTALL_DIR/cipher-mapping.txt"
|
||||
fi
|
||||
|
||||
# still no cipher mapping file (and realpath is not present):
|
||||
if [[ ! -r "$CIPHERS_BY_STRENGTH_FILE" ]] && which readlink &>/dev/null ; then
|
||||
if [[ ! -r "$CIPHERS_BY_STRENGTH_FILE" ]] && command -v readlink &>/dev/null ; then
|
||||
readlink -f ls &>/dev/null && \
|
||||
TESTSSL_INSTALL_DIR=$(dirname $(readlink -f ${BASH_SOURCE[0]})) || \
|
||||
TESTSSL_INSTALL_DIR=$(dirname $(readlink ${BASH_SOURCE[0]}))
|
||||
|
Loading…
Reference in New Issue
Block a user