mirror of
https://github.com/CISOfy/lynis.git
synced 2025-07-26 23:34:25 +02:00
New function to display exceptions
This commit is contained in:
parent
7eba5df9b2
commit
4e39bafd78
@ -40,6 +40,7 @@
|
|||||||
# DiscoverProfiles Determine available profiles on system
|
# DiscoverProfiles Determine available profiles on system
|
||||||
# Display Output text to screen with colors and identation
|
# Display Output text to screen with colors and identation
|
||||||
# DisplayError Show an error on screen
|
# DisplayError Show an error on screen
|
||||||
|
# DisplayException Show an exception on screen
|
||||||
# DisplayManual Output text to screen without any layout
|
# DisplayManual Output text to screen without any layout
|
||||||
# DisplayToolTip Show a tip for improving usage of the tool
|
# DisplayToolTip Show a tip for improving usage of the tool
|
||||||
# DisplayWarning Show a clear warning on screen
|
# DisplayWarning Show a clear warning on screen
|
||||||
@ -656,6 +657,40 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# Name : DisplayException()
|
||||||
|
# Description : Show a discovered exception on screen
|
||||||
|
#
|
||||||
|
# Parameters : $1 = function or test
|
||||||
|
# $2 = text
|
||||||
|
# Returns : <nothing>
|
||||||
|
# Note : This function is usually triggered by ReportException
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
DisplayException() {
|
||||||
|
${ECHOCMD:-echo} ""
|
||||||
|
${ECHOCMD:-echo} "================================================================="
|
||||||
|
${ECHOCMD:-echo} ""
|
||||||
|
${ECHOCMD:-echo} " ${WARNING}Exception found!${NORMAL}"
|
||||||
|
${ECHOCMD:-echo} ""
|
||||||
|
${ECHOCMD:-echo} " Function/test: [$1]"
|
||||||
|
${ECHOCMD:-echo} " Message: ${BOLD}$2${NORMAL}"
|
||||||
|
${ECHOCMD:-echo} ""
|
||||||
|
${ECHOCMD:-echo} " Help improving the Lynis community with your feedback!"
|
||||||
|
${ECHOCMD:-echo} ""
|
||||||
|
${ECHOCMD:-echo} " Steps:"
|
||||||
|
${ECHOCMD:-echo} " - Ensure you are running the latest version ($0 update check)"
|
||||||
|
${ECHOCMD:-echo} " - If so, create a GitHub issue at ${PROGRAM_SOURCE}"
|
||||||
|
${ECHOCMD:-echo} " - Include relevant parts of the log file or configuration file"
|
||||||
|
${ECHOCMD:-echo} ""
|
||||||
|
${ECHOCMD:-echo} " Thanks!"
|
||||||
|
${ECHOCMD:-echo} ""
|
||||||
|
${ECHOCMD:-echo} "================================================================="
|
||||||
|
${ECHOCMD:-echo} ""
|
||||||
|
sleep 5
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Name : DisplayManual()
|
# Name : DisplayManual()
|
||||||
# Description : Show text on screen, without any markup
|
# Description : Show text on screen, without any markup
|
||||||
@ -1429,7 +1464,7 @@
|
|||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
IsDeveloperVersion() {
|
IsDeveloperVersion() {
|
||||||
if [ "${PROGRAM_RELEASE_TYPE}" = "dev" ]; then return 0; else return 1; fi
|
if [ "${PROGRAM_RELEASE_TYPE}" = "pre-release" ]; then return 0; else return 1; fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2764,6 +2799,9 @@
|
|||||||
ReportException() {
|
ReportException() {
|
||||||
Report "exception_event[]=$1|${2-NoInfo}|"
|
Report "exception_event[]=$1|${2-NoInfo}|"
|
||||||
LogText "Exception: test has an exceptional event ($1) with text ${2-NoText}"
|
LogText "Exception: test has an exceptional event ($1) with text ${2-NoText}"
|
||||||
|
if [ ${QUIET} -eq 0 ]; then
|
||||||
|
DisplayException "$1" "$2"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user