Implement tooltips

This commit is contained in:
Michael Boelen 2016-07-05 18:18:54 +02:00
parent 2b2051dca7
commit f8bee58ade
5 changed files with 15 additions and 29 deletions

View File

@ -180,6 +180,7 @@ unset LANG
TESTS_EXECUTED=""
TESTS_SKIPPED=""
TMPFILE=""
TOOLTIP_SHOWED=0
TOTAL_SUGGESTIONS=0
TOTAL_WARNINGS=0
TRIPWIREBINARY=""

View File

@ -444,25 +444,6 @@
}
################################################################################
# Name : DisplayToolTip()
# Description : Show tooltip on screen
#
# Input : $1 = text
# Returns : <nothing>
################################################################################
DisplayToolTip() {
if [ ${SHOW_TOOL_TIPS} -eq 1 ]; then
if [ ${CRONJOB} -eq 0 ]; then
# Check if we already have already discovered a proper echo command tool. It not, set it default to 'echo'.
if [ "${ECHOCMD}" = "" ]; then ECHOCMD="echo"; fi
${ECHOCMD} "${WHITE}[${BLUE}Tool Tip${NORMAL}${WHITE}]${NORMAL}: $1"
else
echo "${TEXT}${RESULTPART}"
fi
fi
}
################################################################################
@ -567,14 +548,16 @@
################################################################################
DisplayToolTip() {
if [ ${SHOW_TOOL_TIPS} -eq 1 ]; then
# Display tooltip when enabled and no tip has been displayed yet
if [ ${SHOW_TOOL_TIPS} -eq 1 -a ${TOOLTIP_SHOWED} -eq 0 ]; then
if [ ${CRONJOB} -eq 0 ]; then
# Check if we already have already discovered a proper echo command tool. It not, set it default to 'echo'.
if [ "${ECHOCMD}" = "" ]; then ECHOCMD="echo"; fi
${ECHOCMD} "${WHITE}[${BLUE}TOOLTIP${NORMAL}${WHITE}]${NORMAL} ${WHITE}$1${NORMAL}"
${ECHOCMD} "${WHITE}[${BLUE}TIP${NORMAL}${WHITE}]${NORMAL}: $1"
else
echo "${TEXT}${RESULTPART}"
fi
TOOLTIP_SHOWED=1
fi
}

View File

@ -30,7 +30,7 @@
COMMANDS="audit show update"
HELPERS="audit configure show update"
OPTIONS="--auditor\n--check-all (-c)\n--config\n--cronjob (--cron)\n--debug\n--developer\n--help (-h)\n--info\n--license-key --log-file\n--manpage_(--man)\n--no-colors --no-log\n--pentest\n--profile\n--plugins-dir\n--quiet (-q)\n--quick (-Q)\n--report-file\n--reverse-colors\n--tests\n--tests-category\n--upload\n--verbose\n--version (-V)\n--view-categories"
OPTIONS="--auditor\n--check-all (-c)\n--config\n--cronjob (--cron)\n--debug\n--developer\n--help (-h)\n--info\n--license-key --log-file\n--manpage (--man)\n--no-colors --no-log\n--pentest\n--profile\n--plugins-dir\n--quiet (-q)\n--quick (-Q)\n--report-file\n--reverse-colors\n--tests\n--tests-category\n--upload\n--verbose\n--version (-V)\n--view-categories"
SHOW_ARGS="commands dbdir help hostids includedir license man options pidfile plugindir profiles release releasedate settings tests version workdir"
SHOW_HELP="lynis show ${BROWN}commands${NORMAL} (all available commands)

View File

@ -31,7 +31,7 @@
CHECK_BINARIES=0
RUN_HELPERS=1
HELPER="audit"
RUN_PLUGINS=0
SKIP_PLUGINS=1
RUN_TESTS=0
if [ ! $2 = "" ]; then
case $2 in
@ -71,7 +71,7 @@
CHECK_BINARIES=0
QUIET=1
RUN_HELPERS=1
RUN_PLUGINS=0
SKIP_PLUGINS=1
RUN_TESTS=0
SHOW_PROGRAM_DETAILS=0
break
@ -80,7 +80,7 @@
CHECK=1
CHECK_BINARIES=1
HELPER=""
RUN_PLUGINS=1
SKIP_PLUGINS=0
RUN_TESTS=1
shift
;;
@ -100,7 +100,7 @@
CHECK_BINARIES=0
RUN_HELPERS=1
QUIET=1
RUN_PLUGINS=0
SKIP_PLUGINS=1
RUN_TESTS=0
SHOW_PROGRAM_DETAILS=0
if [ $# -gt 0 ]; then shift; fi
@ -114,7 +114,7 @@
CHECK_BINARIES=0
RUN_HELPERS=1
HELPER="show"
RUN_PLUGINS=0
SKIP_PLUGINS=1
RUN_TESTS=0
QUIET=1
SHOW_PROGRAM_DETAILS=0
@ -141,7 +141,7 @@
RUN_HELPERS=1
HELPER="update"
QUIET=1
RUN_PLUGINS=0
SKIP_PLUGINS=1
RUN_TESTS=0
SHOW_PROGRAM_DETAILS=0
if [ ! $2 = "" ]; then
@ -298,7 +298,7 @@
# Skip execution of plugins
--skip-plugins | --no-plugins)
RUN_PLUGINS=0
SKIP_PLUGINS=1
;;
# Only scan these tests

2
lynis
View File

@ -983,6 +983,8 @@ ${NORMAL}
LogText "Program ended successfully"
LogText "================================================================================"
if [ -z "${CUSTOM_PROFILE}" ]; then DisplayToolTip "Enhance ${PROGRAM_NAME} audits by adding your settings to custom.prf (see ${DEFAULT_PROFILE} for all settings)"; fi
# Clean exit (Delete PID file)
if [ ${TOTAL_WARNINGS} -gt 0 ]; then
# Use exit code 78 if we found any warnings (and enabled)