From e976e77c577c54fb822e855686e7cbc462079877 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sat, 10 Feb 2024 17:05:32 -0600 Subject: [PATCH] Update default.inc --- default.inc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/default.inc b/default.inc index eb91585..a7f04bf 100755 --- a/default.inc +++ b/default.inc @@ -238,8 +238,11 @@ service_exists() { CHECK_HOST(){ if [ ! -z ${1+x} ]; then - # if [ "$(nmap ${host} -p 22,80,443 -n | grep open)" != "" ] || [ "$(nmap -sU ${host} -p 161 -n | grep open)" != "" ]; then - ping -c 3 ${1} > /dev/null 2>&1 + if [ "$(dpkg-query -W --showformat='${Status}\n' nmap 2>/dev/null | grep "install ok installed")" != "" ]; then + [ "$(nmap ${host} -p 22,80,443 -n | grep open)" != "" ] || [ "$(nmap -sU ${host} -p 161 -n | grep open)" != "" ] && echo true || echo false + else + ping -c 3 ${1} > /dev/null 2>&1 + fi [ $? -ne 0 ] && echo false || echo true else echo false