mirror of
https://github.com/CISOfy/lynis.git
synced 2025-07-29 00:34:14 +02:00
Added new function ContainsString to search for the needle in the haystack
This commit is contained in:
parent
0288c6df34
commit
991083c13f
@ -30,6 +30,7 @@
|
|||||||
# CheckUpdates Determine if a new version of Lynis is available
|
# CheckUpdates Determine if a new version of Lynis is available
|
||||||
# CreateTempFile Create a temporary file
|
# CreateTempFile Create a temporary file
|
||||||
# counttests Count number of performed tests
|
# counttests Count number of performed tests
|
||||||
|
# ContainsString Find the needle (string) in the haystack (another string)
|
||||||
# Debug Display additional information on the screen (not suited for cronjob)
|
# Debug Display additional information on the screen (not suited for cronjob)
|
||||||
# DigitsOnly Return only the digits from a string
|
# DigitsOnly Return only the digits from a string
|
||||||
# DirectoryExists Check if a directory exists on the disk
|
# DirectoryExists Check if a directory exists on the disk
|
||||||
@ -155,6 +156,21 @@
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# Name : ContainsString()
|
||||||
|
# Description : Search a specific string (or regular expression) in another
|
||||||
|
# Returns : (0 - True, 1 - False)
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
ContainsString() {
|
||||||
|
if [ $# -ne 2 ]; then ReportException "ContainsString" "Incorrect number of arguments for ContainsStrings function"; fi
|
||||||
|
RETVAL=1
|
||||||
|
local FIND=`echo "$2" | egrep "$1"`
|
||||||
|
if [ ! "${FIND}" = "" ]; then RETVAL=0; fi
|
||||||
|
|
||||||
|
return $RETVAL
|
||||||
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Name : TestCase_Equal()
|
# Name : TestCase_Equal()
|
||||||
# Description : Test case for checking if value whether value is equal to value
|
# Description : Test case for checking if value whether value is equal to value
|
||||||
|
Loading…
x
Reference in New Issue
Block a user