mirror of https://github.com/CISOfy/lynis.git
Support for show helper utility
This commit is contained in:
parent
c7c400f038
commit
810c37287f
|
@ -0,0 +1,109 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#################################################################################
|
||||||
|
#
|
||||||
|
# Lynis
|
||||||
|
# ------------------
|
||||||
|
#
|
||||||
|
# Copyright 2007-2013, Michael Boelen
|
||||||
|
# Copyright 2013-2016, CISOfy
|
||||||
|
#
|
||||||
|
# Website : https://cisofy.com
|
||||||
|
# Blog : http://linux-audit.com
|
||||||
|
# GitHub : https://github.com/CISOfy/lynis
|
||||||
|
#
|
||||||
|
# Lynis comes with ABSOLUTELY NO WARRANTY. This is free software, and you are
|
||||||
|
# welcome to redistribute it under the terms of the GNU General Public License.
|
||||||
|
# See LICENSE file for usage of this software.
|
||||||
|
#
|
||||||
|
######################################################################
|
||||||
|
#
|
||||||
|
# Helper program to share details
|
||||||
|
#
|
||||||
|
######################################################################
|
||||||
|
#
|
||||||
|
# Options:
|
||||||
|
# ---------
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# How to use:
|
||||||
|
# ------------
|
||||||
|
# Run: lynis show <option>
|
||||||
|
#
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
COMMANDS="audit\nshow\nupdate"
|
||||||
|
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"
|
||||||
|
SHOW_ARGS="commands help license man options pidfile profiles release releasedate version"
|
||||||
|
|
||||||
|
AUDIT_ARGS="dockerfile system"
|
||||||
|
UPDATE_ARGS="info release"
|
||||||
|
|
||||||
|
COMMANDS_AUDIT_SYSTEM_USAGE="Usage: lynis audit system"
|
||||||
|
COMMANDS_AUDIT_SYSTEM_FUNCTION="Function: performs a security audit of the system"
|
||||||
|
|
||||||
|
if [ $# -gt 0 ]; then
|
||||||
|
case $1 in
|
||||||
|
"commands")
|
||||||
|
if [ $# -eq 1 ]; then
|
||||||
|
echo "Commands:\n${COMMANDS}"
|
||||||
|
else
|
||||||
|
shift
|
||||||
|
if [ $# -eq 1 ]; then
|
||||||
|
case $1 in
|
||||||
|
"audit") echo "${AUDIT_ARGS}" ;;
|
||||||
|
*) echo "Unknown argument for 'commands'"
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
shift
|
||||||
|
case $1 in
|
||||||
|
"dockerfile")
|
||||||
|
echo "Usage: lynis audit dockerfile <file>"
|
||||||
|
;;
|
||||||
|
"system")
|
||||||
|
printf "${COMMANDS_AUDIT_SYSTEM_USAGE}\n${COMMANDS_AUDIT_SYSTEM_FUNCTION}\n"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unknown argument for 'commands'"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"help")
|
||||||
|
if [ $# -eq 1 ]; then
|
||||||
|
echo "${CYAN}Commands${NORMAL}:\n${COMMANDS}\n\n${WHITE}Options${NORMAL}:\n${OPTIONS}"
|
||||||
|
else
|
||||||
|
shift
|
||||||
|
case $1 in
|
||||||
|
"audit") echo "${AUDIT_ARGS}" ;;
|
||||||
|
"show") echo "${SHOW_ARGS}" ;;
|
||||||
|
"update") echo "${UPDATE_ARGS}" ;;
|
||||||
|
"?") echo "${SHOW_ARGS}" ;;
|
||||||
|
*) echo "Invalid argument provided" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
"license") echo "${PROGRAM_LICENSE}" ;;
|
||||||
|
"man") echo "Use ./lynis --man or man lynis" ;;
|
||||||
|
"options") echo "${OPTIONS}" ;;
|
||||||
|
"pidfile") echo "${PIDFILE}" ;;
|
||||||
|
"profile" | "profiles") for I in ${PROFILES}; do echo ${I}; done ;;
|
||||||
|
"plugindir") echo "${PLUGINDIR}" ;;
|
||||||
|
"release" | "version") echo "${PROGRAM_VERSION}" ;;
|
||||||
|
"releasedate") echo "${PROGRAM_RELEASE_DATE}" ;;
|
||||||
|
"?") echo "${SHOW_ARGS}" ;;
|
||||||
|
*) echo "Unknown option" ;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
printf "${YELLOW}Need an additional argument${NORMAL}\n\n"
|
||||||
|
for I in ${SHOW_ARGS}; do
|
||||||
|
echo "lynis show ${I}"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
ExitClean
|
||||||
|
|
||||||
|
# The End
|
|
@ -68,7 +68,32 @@
|
||||||
#break
|
#break
|
||||||
;;
|
;;
|
||||||
|
|
||||||
# Helpers first
|
show)
|
||||||
|
CHECK_BINARIES=0
|
||||||
|
RUN_HELPERS=1
|
||||||
|
HELPER="show"
|
||||||
|
RUN_PLUGINS=0
|
||||||
|
RUN_TESTS=0
|
||||||
|
QUIET=1
|
||||||
|
SHOW_PROGRAM_DETAILS=0
|
||||||
|
shift
|
||||||
|
HELPER_PARAMS="$1 $2"
|
||||||
|
break
|
||||||
|
#if [ ! $2 = "" ]; then
|
||||||
|
# shift
|
||||||
|
# HELPER_PARAMS="$1 $2"
|
||||||
|
# break
|
||||||
|
# else
|
||||||
|
# echo "${RED}Error: ${WHITE}Need more specifics for show${NORMAL}"
|
||||||
|
# echo " "
|
||||||
|
# echo "Examples:"
|
||||||
|
# echo "lynis show config"
|
||||||
|
# echo "lynis show plugins"
|
||||||
|
# echo "lynis show version"
|
||||||
|
# ExitFatal
|
||||||
|
#fi
|
||||||
|
;;
|
||||||
|
|
||||||
update)
|
update)
|
||||||
CHECK_BINARIES=0
|
CHECK_BINARIES=0
|
||||||
RUN_HELPERS=1
|
RUN_HELPERS=1
|
||||||
|
|
Loading…
Reference in New Issue