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>2016-07-05 20:57:11 +0300
committerMichael Boelen <michael.boelen@cisofy.com>2016-07-05 20:57:11 +0300
commit13c228fd2d4a4e90df1b0331532b35333e7446de (patch)
tree03124e55218a2772bb86a96454859856104bbd22 /include/helper_show
parent1655b5728bfd42166bc931058892e5b3fe45991e (diff)
Add --configured-only option to lynis show settings
Diffstat (limited to 'include/helper_show')
-rw-r--r--include/helper_show20
1 files changed, 15 insertions, 5 deletions
diff --git a/include/helper_show b/include/helper_show
index 74ece537..5aed1ba4 100644
--- a/include/helper_show
+++ b/include/helper_show
@@ -96,7 +96,7 @@ UPDATE_HELP="
"
-SHOW_SETTINGS_ARGS="--brief --nocolors"
+SHOW_SETTINGS_ARGS="--brief --configured-only --nocolors"
SHOW_TESTS_ARGS="skipped"
COMMANDS_AUDIT_SYSTEM_USAGE="Usage: lynis audit system"
@@ -181,11 +181,14 @@ if [ $# -gt 0 ]; then
"releasedate") ${ECHOCMD} "${PROGRAM_RELEASE_DATE}" ;;
"settings")
BRIEF_OUTPUT=0
+ COLORED_OUTPUT=1
+ CONFIGURED_ONLY_OUTPUT=0
while [ $# -gt 1 ]; do
shift
case $1 in
- "--brief") BRIEF_OUTPUT=1 ;;
- "--nocolors") GRAY=""; WHITE=""; CYAN="" ;;
+ "--brief" | "--br") BRIEF_OUTPUT=1 ;;
+ "--configured-only" | "--co") CONFIGURED_ONLY_OUTPUT=1 ;;
+ "--nocolors" | "--nc") COLORED_OUTPUT=0 ;;
*)
${ECHOCMD} "${RED}Error${NORMAL}: Invalid argument provided to 'lynis show settings'\n\n"
${ECHOCMD} "Suggestions:"
@@ -194,6 +197,7 @@ if [ $# -gt 0 ]; then
;;
esac
done
+ if [ ${COLORED_OUTPUT} -eq 0 ]; then BLUE=""; CYAN=""; GRAY=""; WHITE=""; fi
# Sort all settings and display them
SETTINGS=$(sort ${SETTINGS_FILE} | sed 's/ /:space:/g')
for LINE in ${SETTINGS}; do
@@ -202,14 +206,20 @@ if [ $# -gt 0 ]; then
DESCRIPTION=$(echo ${LINE} | awk -F';' '{print $3}' | sed 's/:space:/ /g')
LINESIZE=$(echo "${SETTING}=${VALUE}" | wc -m | tr -d ' ')
SPACES=$((60 - ${LINESIZE}))
- # Only show configured settings
+ if [ -z "${VALUE}" -a ${CONFIGURED_ONLY_OUTPUT} -eq 0 ]; then VALUE="${GRAY}[not configured]${NORMAL}"; fi
if [ ! -z "${VALUE}" ]; then
if [ ${BRIEF_OUTPUT} -eq 0 ]; then ${ECHOCMD} "${GRAY}# ${DESCRIPTION}${NORMAL}"; fi
${ECHOCMD} "${WHITE}${SETTING}${NORMAL}=${CYAN}${VALUE}${NORMAL}"
if [ ${BRIEF_OUTPUT} -eq 0 ]; then ${ECHOCMD} ""; fi
fi
done
- if [ ${BRIEF_OUTPUT} -eq 0 ]; then DisplayToolTip "add --brief to show just the settings, --nocolors to remove colors"; fi
+ if [ ${BRIEF_OUTPUT} -eq 0 -a ${CONFIGURED_ONLY_OUTPUT} -eq 0 -a ${COLORED_OUTPUT} -eq 1 ]; then
+ if [ ${COLORS} -eq 1 ]; then
+ DisplayToolTip "Add --brief to hide descriptions, --configured-only to show configured items only, or --nocolors to remove colors"
+ else
+ DisplayToolTip "Add --brief to hide descriptions, --configured-only to show configured items only"
+ fi
+ fi
;;
"tests")