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-28 12:10:59 +0300
committerMichael Boelen <michael.boelen@cisofy.com>2016-07-28 12:10:59 +0300
commitdb5d825701198c9e487b50ca05ec680d83176c94 (patch)
tree681d48e3839b0193befbccf3641dd58e50b39240 /include/parameters
parentf498d7bf2cf1986c3fe9ea7d03b468fcbd2e7895 (diff)
Check for number of arguments
Diffstat (limited to 'include/parameters')
-rw-r--r--include/parameters59
1 files changed, 31 insertions, 28 deletions
diff --git a/include/parameters b/include/parameters
index 848dc453..219528fa 100644
--- a/include/parameters
+++ b/include/parameters
@@ -33,7 +33,7 @@
HELPER="audit"
SKIP_PLUGINS=1
RUN_TESTS=0
- if [ ! $2 = "" ]; then
+ if [ $# -gt 1 ]; then
case $2 in
"dockerfile")
if [ "$3" = "" ]; then
@@ -48,33 +48,35 @@
fi
;;
"system")
- if [ "$3" = "remote" ]; then
- shift
- if [ "$3" = "" ]; then
- echo "${RED}Error: ${WHITE}Missing remote location${NORMAL}"
- echo "Example: $0 audit system remote 192.168.1.100"
- ExitFatal
- else
- REMOTE_TARGET="$3"
- shift; shift; shift # shift out first three arguments
- EXTRA_PARAMS=""
- if [ ! "$1" = "" ]; then EXTRA_PARAMS=" $@"; fi
- # --quick is added to be non-interactive
- REMOTE_COMMAND="./lynis audit system --quick${EXTRA_PARAMS}"
- echo ""
- echo " How to perform a remote scan:"
- echo " ============================="
- echo " Target : ${REMOTE_TARGET}"
- echo " Command : ${REMOTE_COMMAND}"
- HELPER="system_remote_scan"
- HELPER_PARAMS="$@"
- CHECK_BINARIES=0
- QUIET=1
- RUN_HELPERS=1
- SKIP_PLUGINS=1
- RUN_TESTS=0
- SHOW_PROGRAM_DETAILS=0
- break
+ if [ $# -gt 2 ]; then
+ if [ "$3" = "remote" ]; then
+ shift
+ if [ "$3" = "" ]; then
+ echo "${RED}Error: ${WHITE}Missing remote location${NORMAL}"
+ echo "Example: $0 audit system remote 192.168.1.100"
+ ExitFatal
+ else
+ REMOTE_TARGET="$3"
+ shift; shift; shift # shift out first three arguments
+ EXTRA_PARAMS=""
+ if [ ! "$1" = "" ]; then EXTRA_PARAMS=" $@"; fi
+ # --quick is added to be non-interactive
+ REMOTE_COMMAND="./lynis audit system --quick${EXTRA_PARAMS}"
+ echo ""
+ echo " How to perform a remote scan:"
+ echo " ============================="
+ echo " Target : ${REMOTE_TARGET}"
+ echo " Command : ${REMOTE_COMMAND}"
+ HELPER="system_remote_scan"
+ HELPER_PARAMS="$@"
+ CHECK_BINARIES=0
+ QUIET=1
+ RUN_HELPERS=1
+ SKIP_PLUGINS=1
+ RUN_TESTS=0
+ SHOW_PROGRAM_DETAILS=0
+ break
+ fi
fi
fi
CHECK=1
@@ -83,6 +85,7 @@
SKIP_PLUGINS=0
RUN_TESTS=1
shift
+
;;
esac
else