From 098f7685fc35ce8149b3107efd466b9e61b7dc4b Mon Sep 17 00:00:00 2001 From: Michael Boelen Date: Sat, 14 May 2016 18:04:26 +0200 Subject: [PATCH] Added show dbdir, show includedir, show workdir --- include/helper_show | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/include/helper_show b/include/helper_show index a6ea3948..5e580f28 100644 --- a/include/helper_show +++ b/include/helper_show @@ -31,9 +31,11 @@ COMMANDS="audit 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" -SHOW_ARGS="commands help license man options pidfile plugindir profiles release releasedate tests version" +SHOW_ARGS="commands dbdir help includedir license man options pidfile plugindir profiles release releasedate tests version workdir" SHOW_HELP="lynis show ${BROWN}commands${NORMAL} (all available commands) +lynis show ${BROWN}dbdir${NORMAL} (database directory) lynis show ${BROWN}help${NORMAL} (detailed information about arguments) +lynis show ${BROWN}includedir${NORMAL} (include directory for tests and functions) lynis show ${BROWN}license${NORMAL} (license details) lynis show ${BROWN}man${NORMAL} (show help) lynis show ${BROWN}options${NORMAL} (available flags and options) @@ -43,7 +45,8 @@ lynis show ${BROWN}profiles${NORMAL} (discovered profiles) lynis show ${BROWN}release${NORMAL} (version) lynis show ${BROWN}releasedate${NORMAL} (date of release) lynis show ${BROWN}tests skipped${NORMAL} (which tests to skip according profile) -lynis show ${BROWN}version${NORMAL} (${PROGRAM_NAME} version)" +lynis show ${BROWN}version${NORMAL} (${PROGRAM_NAME} version) +lynis show ${BROWN}workdir${NORMAL} (work directory)" AUDIT_ARGS="( dockerfile | system )" AUDIT_HELP=" @@ -128,6 +131,13 @@ if [ $# -gt 0 ]; then fi fi ;; + "dbdir") + SHOW_DBDIR="${DBDIR}" + if [ "${DBDIR}" = "./db" ]; then + if [ -d ${WORKDIR}/db ]; then SHOW_DBDIR="${WORKDIR}/db"; fi + fi + ${ECHOCMD} "${SHOW_DBDIR}" + ;; "help") if [ $# -eq 1 ]; then ${ECHOCMD} "${PROGRAM_NAME} ${PROGRAM_VERSION} - Help" @@ -138,7 +148,7 @@ if [ $# -gt 0 ]; then ${ECHOCMD} "${CYAN}${I}${NORMAL}" done ${ECHOCMD} "" - ${ECHOCMD} "Use 'lynis show help ' to see details" + ${ECHOCMD} "Use 'lynis show help ${CYAN}${NORMAL}' to see details" ${ECHOCMD} ""; ${ECHOCMD} "" ${ECHOCMD} "${WHITE}Options${NORMAL}:\n${GRAY}${OPTIONS}${NORMAL}" else @@ -152,7 +162,13 @@ if [ $# -gt 0 ]; then esac fi ;; - + "includedir") + SHOW_INCLUDEDIR="${INCLUDEDIR}" + if [ "${INCLUDEDIR}" = "./include" ]; then + if [ -d ${WORKDIR}/include ]; then SHOW_INCLUDEDIR="${WORKDIR}/include"; fi + fi + ${ECHOCMD} "${SHOW_INCLUDEDIR}" + ;; "license") ${ECHOCMD} "${PROGRAM_LICENSE}" ;; "man") ${ECHOCMD} "Use ./lynis --man or man lynis" ;; "options") ${ECHOCMD} "${OPTIONS}" ;; @@ -176,6 +192,7 @@ if [ $# -gt 0 ]; then ${ECHOCMD} "Need more arguments" fi ;; + "workdir") ${ECHOCMD} "${WORKDIR}" ;; "?") ${ECHOCMD} "${SHOW_ARGS}" ;; *) ${ECHOCMD} "Unknown argument '$1'" ;; esac