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