Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/CISOfy/lynis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Boelen <michael.boelen@cisofy.com>2019-08-21 15:50:32 +0300
committerMichael Boelen <michael.boelen@cisofy.com>2019-08-21 15:50:32 +0300
commit4e39bafd7850cffc9905a1acd897b6309feadc59 (patch)
tree2796aa940f94ce3778ba0885f19a8b580eea43e9 /include/functions
parent7eba5df9b2017a57d17d9088cdffaad0ebb64593 (diff)
New function to display exceptions
Diffstat (limited to 'include/functions')
-rw-r--r--include/functions40
1 files changed, 39 insertions, 1 deletions
diff --git a/include/functions b/include/functions
index 816d0cd1..9719b0ae 100644
--- a/include/functions
+++ b/include/functions
@@ -40,6 +40,7 @@
# DiscoverProfiles Determine available profiles on system
# Display Output text to screen with colors and identation
# DisplayError Show an error on screen
+# DisplayException Show an exception on screen
# DisplayManual Output text to screen without any layout
# DisplayToolTip Show a tip for improving usage of the tool
# DisplayWarning Show a clear warning on screen
@@ -657,6 +658,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()
# Description : Show text on screen, without any markup
#
@@ -1429,7 +1464,7 @@
################################################################################
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() {
Report "exception_event[]=$1|${2-NoInfo}|"
LogText "Exception: test has an exceptional event ($1) with text ${2-NoText}"
+ if [ ${QUIET} -eq 0 ]; then
+ DisplayException "$1" "$2"
+ fi
}