From 7f45bb5d850d5320208936274ac92d06b589f095 Mon Sep 17 00:00:00 2001 From: mboelen Date: Fri, 5 Dec 2014 16:01:41 +0100 Subject: [PATCH] Only include numeric characters in latest version string --- include/functions | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/functions b/include/functions index dcc8e147..9b2b4989 100644 --- a/include/functions +++ b/include/functions @@ -119,16 +119,16 @@ LYNIS_LV_RECORD="lynis-latest-version.cisofy.com." FIND=`which dig 2> /dev/null` if [ ! "${FIND}" = "" ]; then - PROGRAM_LV=`dig +short +time=3 -t txt lynis-latest-version.cisofy.com 2> /dev/null | grep -v "connection timed out" | sed 's/[".]//g'` + PROGRAM_LV=`dig +short +time=3 -t txt lynis-latest-version.cisofy.com 2> /dev/null | grep -v "connection timed out" | sed 's/[".]//g' | grep "^[1-9][0-9][0-9]$"` else FIND=`which host 2> /dev/null` if [ ! "${FIND}" = "" ]; then - PROGRAM_LV=`host -t txt -W 3 lynis-latest-version.cisofy.com 2> /dev/null | grep -v "connection timed out" | awk '{ if ($1=="lynis-latest-version.cisofy.com" && $3=="text") { print $4 }}' | sed 's/"//g'` + PROGRAM_LV=`host -t txt -W 3 lynis-latest-version.cisofy.com 2> /dev/null | grep -v "connection timed out" | awk '{ if ($1=="lynis-latest-version.cisofy.com" && $3=="text") { print $4 }}' | sed 's/"//g' | grep "^[1-9][0-9][0-9]$"` if [ "${PROGRAM_LV}" = "" ]; then PROGRAM_LV=0; fi else FIND=`which drill 2> /dev/null` if [ ! "${FIND}" = "" ]; then - PROGRAM_LV=`drill txt ${LYNIS_LV_RECORD} | awk '{ if ($1=="lynis-latest-version.cisofy.com." && $4=="TXT") { print $5 }}' | tr -d '"'` + PROGRAM_LV=`drill txt ${LYNIS_LV_RECORD} | awk '{ if ($1=="lynis-latest-version.cisofy.com." && $4=="TXT") { print $5 }}' | tr -d '"' | grep "^[1-9][0-9][0-9]$"` if [ "${PROGRAM_LV}" = "" ]; then PROGRAM_LV=0; fi else logtext "Result: dig, drill or host not installed, update check skipped"