Added more details to show command

This commit is contained in:
mboelen 2016-04-12 21:59:23 +02:00
parent 3e38d2fae5
commit 59bbacd59b
1 changed files with 43 additions and 9 deletions

View File

@ -32,11 +32,34 @@
# #
###################################################################### ######################################################################
COMMANDS="audit\nshow\nupdate" COMMANDS="audit show update"
OPTIONS="--auditor\n--check-all_(-c)\n--config\n--cronjob (--cron)\n--debug\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--version (-V)\n--view-categories\n" OPTIONS="--auditor\n--check-all (-c)\n--config\n--cronjob (--cron)\n--debug\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--version (-V)\n--view-categories"
SHOW_ARGS="commands help license man options pidfile profiles release releasedate version" SHOW_ARGS="commands help license man options pidfile profiles release releasedate version"
SHOW_HELP="lynis show ${BROWN}commands${NORMAL} (all available commands)
lynis show ${BROWN}help${NORMAL} (detailed information about arguments)
lynis show ${BROWN}license${NORMAL} (license details)
lynis show ${BROWN}man${NORMAL} (show help)
lynis show ${BROWN}options${NORMAL} (available flags and options)
lynis show ${BROWN}pidfile${NORMAL} (active file to stored process ID)
lynis show ${BROWN}profiles${NORMAL} (discovered profiles)
lynis show ${BROWN}release${NORMAL} (version)
lynis show ${BROWN}releasedate${NORMAL} (date of release)
lynis show ${BROWN}version${NORMAL} (${PROGRAM_NAME} version)"
AUDIT_ARGS="( dockerfile | system )"
AUDIT_HELP="
audit ${CYAN}dockerfile${NORMAL}
Perform audit on a Docker build file
${GRAY}Usage:${NORMAL} lynis audit dockerfile ${BROWN}<file>${NORMAL}
audit ${CYAN}system${NORMAL}
Perform system audit
${DARKGRAY}Usage:${NORMAL} lynis audit system
"
AUDIT_ARGS="dockerfile system"
UPDATE_ARGS="info release" UPDATE_ARGS="info release"
COMMANDS_AUDIT_SYSTEM_USAGE="Usage: lynis audit system" COMMANDS_AUDIT_SYSTEM_USAGE="Usage: lynis audit system"
@ -46,12 +69,17 @@ if [ $# -gt 0 ]; then
case $1 in case $1 in
"commands") "commands")
if [ $# -eq 1 ]; then if [ $# -eq 1 ]; then
echo "Commands:\n${COMMANDS}" echo "\n${WHITE}Commands:${NORMAL}"
for I in ${COMMANDS}; do
echo "lynis ${CYAN}${I}${NORMAL}"
done
echo ""
else else
shift shift
if [ $# -eq 1 ]; then if [ $# -eq 1 ]; then
case $1 in case $1 in
"audit") echo "${AUDIT_ARGS}" ;; "audit") printf "${AUDIT_HELP}" ;;
"show") echo "${SHOW_HELP}" ;;
*) echo "Unknown argument for 'commands'" *) echo "Unknown argument for 'commands'"
esac esac
else else
@ -72,11 +100,16 @@ if [ $# -gt 0 ]; then
;; ;;
"help") "help")
if [ $# -eq 1 ]; then if [ $# -eq 1 ]; then
echo "${CYAN}Commands${NORMAL}:\n${COMMANDS}\n\n${WHITE}Options${NORMAL}:\n${OPTIONS}" echo "${WHITE}Commands${NORMAL}:"
for I in ${COMMANDS}; do
echo "lynis ${CYAN}${I}${NORMAL}"
done
echo ""
echo "${WHITE}Options${NORMAL}:\n${BLUE}${OPTIONS}${NORMAL}"
else else
shift shift
case $1 in case $1 in
"audit") echo "${AUDIT_ARGS}" ;; "audit") echo "${AUDIT_HELP}" ;;
"show") echo "${SHOW_ARGS}" ;; "show") echo "${SHOW_ARGS}" ;;
"update") echo "${UPDATE_ARGS}" ;; "update") echo "${UPDATE_ARGS}" ;;
"?") echo "${SHOW_ARGS}" ;; "?") echo "${SHOW_ARGS}" ;;
@ -97,10 +130,11 @@ if [ $# -gt 0 ]; then
*) echo "Unknown option" ;; *) echo "Unknown option" ;;
esac esac
else else
printf "${YELLOW}Need an additional argument${NORMAL}\n\n" printf "\n ${WHITE}Provide an additional argument${NORMAL}\n\n"
for I in ${SHOW_ARGS}; do for I in ${SHOW_ARGS}; do
echo "lynis show ${I}" echo " lynis show ${BROWN}${I}${NORMAL}"
done done
printf "\n"
fi fi