mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-10 14:55:00 +00:00
work on adding basic/monochrome mode
This commit is contained in:
70
prowler
70
prowler
@@ -26,30 +26,15 @@
|
||||
# Exits if any error is found
|
||||
# set -e
|
||||
|
||||
# Colors
|
||||
NORMAL="[0;39m"
|
||||
WARNING="[1;33m" # Bad (red)
|
||||
SECTION="[1;33m" # Section (yellow)
|
||||
NOTICE="[1;33m" # Notice (yellow)
|
||||
OK="[1;32m" # Ok (green)
|
||||
BAD="[1;31m" # Bad (red)
|
||||
CYAN="[0;36m"
|
||||
BLUE="[0;34m"
|
||||
BROWN="[0;33m"
|
||||
DARKGRAY="[0;30m"
|
||||
GRAY="[0;37m"
|
||||
GREEN="[1;32m"
|
||||
MAGENTA="[1;35m"
|
||||
PURPLE="[0;35m"
|
||||
RED="[1;31m"
|
||||
YELLOW="[1;33m"
|
||||
WHITE="[1;37m"
|
||||
OPTRED="[1;31m"
|
||||
OPTNORMAL="[0;39m"
|
||||
|
||||
# Set the defaults for these getopts variables
|
||||
PROFILE="default"
|
||||
REGION="us-east-1"
|
||||
FILTERREGION=""
|
||||
MAXITEMS=100
|
||||
MONOCHROME=0
|
||||
|
||||
# Command usage menu
|
||||
usage(){
|
||||
@@ -61,17 +46,20 @@ usage(){
|
||||
-c <checknum> specify a check number or group from the AWS CIS benchmark (i.e.: check11 for check 1.1 or check3 for entire section 3)
|
||||
-f <filterregion> specify an AWS region to run checks against (i.e.: us-west-1)
|
||||
-m <maxitems> specify the maximum number of items to return for long-running requests (default: 100)
|
||||
-b do not use colors in the output
|
||||
-h this help
|
||||
"
|
||||
exit
|
||||
}
|
||||
|
||||
while getopts "hp:r:c:f:m:" OPTION; do
|
||||
while getopts "hbp:r:c:f:m:" OPTION; do
|
||||
case $OPTION in
|
||||
h )
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
b )
|
||||
MONOCHROME=1
|
||||
p )
|
||||
PROFILE=$OPTARG
|
||||
;;
|
||||
@@ -88,17 +76,57 @@ while getopts "hp:r:c:f:m:" OPTION; do
|
||||
MAXITEMS=$OPTARG
|
||||
;;
|
||||
: )
|
||||
echo -e "\n$RED ERROR!$NORMAL -$OPTARG requires an argument\n"
|
||||
echo -e "\n$OPTRED ERROR!$OPTNORMAL -$OPTARG requires an argument\n"
|
||||
exit 1
|
||||
;;
|
||||
? )
|
||||
echo -e "\n$RED ERROR!$NORMAL Invalid option"
|
||||
echo -e "\n$OPTRED ERROR!$OPTNORMAL Invalid option"
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ $MONOCHROME -eq 1 ]]; then
|
||||
# Colors
|
||||
NORMAL=""
|
||||
WARNING="" # Bad (red)
|
||||
SECTION="" # Section (yellow)
|
||||
NOTICE="" # Notice (yellow)
|
||||
OK="" # Ok (green)
|
||||
BAD="" # Bad (red)
|
||||
CYAN=""
|
||||
BLUE=""
|
||||
BROWN=""
|
||||
DARKGRAY=""
|
||||
GRAY=""
|
||||
GREEN=""
|
||||
MAGENTA=""
|
||||
PURPLE=""
|
||||
RED=""
|
||||
YELLOW=""
|
||||
WHITE=""
|
||||
else
|
||||
# Colors
|
||||
NORMAL="[0;39m"
|
||||
WARNING="[1;33m" # Bad (red)
|
||||
SECTION="[1;33m" # Section (yellow)
|
||||
NOTICE="[1;33m" # Notice (yellow)
|
||||
OK="[1;32m" # Ok (green)
|
||||
BAD="[1;31m" # Bad (red)
|
||||
CYAN="[0;36m"
|
||||
BLUE="[0;34m"
|
||||
BROWN="[0;33m"
|
||||
DARKGRAY="[0;30m"
|
||||
GRAY="[0;37m"
|
||||
GREEN="[1;32m"
|
||||
MAGENTA="[1;35m"
|
||||
PURPLE="[0;35m"
|
||||
RED="[1;31m"
|
||||
YELLOW="[1;33m"
|
||||
WHITE="[1;37m"
|
||||
fi
|
||||
|
||||
# Functions to manage dates depending on OS
|
||||
if [[ "$OSTYPE" == "linux-gnu" ]]; then
|
||||
# function to compare in days, usage how_older_from_today date
|
||||
|
||||
Reference in New Issue
Block a user