Added show dbdir, show includedir, show workdir

This commit is contained in:
Michael Boelen 2016-05-14 18:04:26 +02:00
parent 18fb54e92d
commit 098f7685fc
1 changed files with 21 additions and 4 deletions

View File

@ -31,9 +31,11 @@
COMMANDS="audit show update" 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" 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) 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}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}license${NORMAL} (license details)
lynis show ${BROWN}man${NORMAL} (show help) lynis show ${BROWN}man${NORMAL} (show help)
lynis show ${BROWN}options${NORMAL} (available flags and options) 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}release${NORMAL} (version)
lynis show ${BROWN}releasedate${NORMAL} (date of release) lynis show ${BROWN}releasedate${NORMAL} (date of release)
lynis show ${BROWN}tests skipped${NORMAL} (which tests to skip according profile) 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_ARGS="( dockerfile | system )"
AUDIT_HELP=" AUDIT_HELP="
@ -128,6 +131,13 @@ if [ $# -gt 0 ]; then
fi fi
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") "help")
if [ $# -eq 1 ]; then if [ $# -eq 1 ]; then
${ECHOCMD} "${PROGRAM_NAME} ${PROGRAM_VERSION} - Help" ${ECHOCMD} "${PROGRAM_NAME} ${PROGRAM_VERSION} - Help"
@ -138,7 +148,7 @@ if [ $# -gt 0 ]; then
${ECHOCMD} "${CYAN}${I}${NORMAL}" ${ECHOCMD} "${CYAN}${I}${NORMAL}"
done done
${ECHOCMD} "" ${ECHOCMD} ""
${ECHOCMD} "Use 'lynis show help <command>' to see details" ${ECHOCMD} "Use 'lynis show help ${CYAN}<command>${NORMAL}' to see details"
${ECHOCMD} ""; ${ECHOCMD} "" ${ECHOCMD} ""; ${ECHOCMD} ""
${ECHOCMD} "${WHITE}Options${NORMAL}:\n${GRAY}${OPTIONS}${NORMAL}" ${ECHOCMD} "${WHITE}Options${NORMAL}:\n${GRAY}${OPTIONS}${NORMAL}"
else else
@ -152,7 +162,13 @@ if [ $# -gt 0 ]; then
esac esac
fi 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}" ;; "license") ${ECHOCMD} "${PROGRAM_LICENSE}" ;;
"man") ${ECHOCMD} "Use ./lynis --man or man lynis" ;; "man") ${ECHOCMD} "Use ./lynis --man or man lynis" ;;
"options") ${ECHOCMD} "${OPTIONS}" ;; "options") ${ECHOCMD} "${OPTIONS}" ;;
@ -176,6 +192,7 @@ if [ $# -gt 0 ]; then
${ECHOCMD} "Need more arguments" ${ECHOCMD} "Need more arguments"
fi fi
;; ;;
"workdir") ${ECHOCMD} "${WORKDIR}" ;;
"?") ${ECHOCMD} "${SHOW_ARGS}" ;; "?") ${ECHOCMD} "${SHOW_ARGS}" ;;
*) ${ECHOCMD} "Unknown argument '$1'" ;; *) ${ECHOCMD} "Unknown argument '$1'" ;;
esac esac