Add quiet mode that only logs failures

This commit is contained in:
Dom Bellizzi
2019-12-18 22:06:44 +00:00
parent d2b3e5ecdc
commit f979c7334f
3 changed files with 15 additions and 1 deletions

View File

@@ -222,6 +222,7 @@ This script has been written in bash using AWS-CLI and it works in Linux and OSX
-b do not print Prowler banner -b do not print Prowler banner
-V show version number & exit -V show version number & exit
-s show scoring report -s show scoring report
-q suppress info messages and passing test output
-h this help -h this help
``` ```

View File

@@ -13,6 +13,10 @@
# Output formatting functions # Output formatting functions
textPass(){ textPass(){
if [[ "$QUIET" == 1 ]]; then
return
fi
PASS_COUNTER=$((PASS_COUNTER+1)) PASS_COUNTER=$((PASS_COUNTER+1))
if [[ "$MODE" == "csv" ]]; then if [[ "$MODE" == "csv" ]]; then
if [[ $2 ]]; then if [[ $2 ]]; then
@@ -55,6 +59,10 @@ textPass(){
} }
textInfo(){ textInfo(){
if [[ "$QUIET" == 1 ]]; then
return
fi
if [[ "$MODE" == "csv" ]]; then if [[ "$MODE" == "csv" ]]; then
if [[ $2 ]]; then if [[ $2 ]]; then
REPREGION=$2 REPREGION=$2

View File

@@ -40,6 +40,7 @@ FILTERREGION=""
MAXITEMS=100 MAXITEMS=100
MONOCHROME=0 MONOCHROME=0
MODE="text" MODE="text"
QUIET=0
SEP=',' SEP=','
KEEPCREDREPORT=0 KEEPCREDREPORT=0
EXITCODE=0 EXITCODE=0
@@ -75,12 +76,13 @@ USAGE:
-V show version number & exit -V show version number & exit
-s show scoring report -s show scoring report
-x specify external directory with custom checks (i.e. /my/own/checks, files must start by "check") -x specify external directory with custom checks (i.e. /my/own/checks, files must start by "check")
-q suppress info messages and passing test output
-h this help -h this help
" "
exit exit
} }
while getopts ":hlLkp:r:c:g:f:m:M:E:enbVsx:" OPTION; do while getopts ":hlLkqp:r:c:g:f:m:M:E:enbVsx:" OPTION; do
case $OPTION in case $OPTION in
h ) h )
usage usage
@@ -140,6 +142,9 @@ while getopts ":hlLkp:r:c:g:f:m:M:E:enbVsx:" OPTION; do
x ) x )
EXTERNAL_CHECKS_PATH=$OPTARG EXTERNAL_CHECKS_PATH=$OPTARG
;; ;;
q )
QUIET=1
;;
: ) : )
echo "" echo ""
echo "$OPTRED ERROR!$OPTNORMAL -$OPTARG requires an argument" echo "$OPTRED ERROR!$OPTNORMAL -$OPTARG requires an argument"