mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-10 14:55:00 +00:00
Merge pull request #202 from ceyes/master
Fix curl error; improve default region
This commit is contained in:
17
prowler
17
prowler
@@ -23,7 +23,7 @@ OPTRED="[1;31m"
|
|||||||
OPTNORMAL="[0;39m"
|
OPTNORMAL="[0;39m"
|
||||||
|
|
||||||
# Set the defaults for these getopts variables
|
# Set the defaults for these getopts variables
|
||||||
REGION="us-east-1"
|
REGION=""
|
||||||
FILTERREGION=""
|
FILTERREGION=""
|
||||||
MAXITEMS=100
|
MAXITEMS=100
|
||||||
MONOCHROME=0
|
MONOCHROME=0
|
||||||
@@ -76,7 +76,7 @@ while getopts ":hlkp:r:c:f:m:M:en" OPTION; do
|
|||||||
PROFILE=$OPTARG
|
PROFILE=$OPTARG
|
||||||
;;
|
;;
|
||||||
r )
|
r )
|
||||||
REGION=$OPTARG
|
REGION_OPT=$OPTARG
|
||||||
;;
|
;;
|
||||||
c )
|
c )
|
||||||
CHECKNUMBER=$OPTARG
|
CHECKNUMBER=$OPTARG
|
||||||
@@ -250,6 +250,9 @@ fi
|
|||||||
# instance profile (metadata server) if runs in an EC2 instance
|
# instance profile (metadata server) if runs in an EC2 instance
|
||||||
|
|
||||||
INSTANCE_PROFILE=$(curl -s -m 1 http://169.254.169.254/latest/meta-data/iam/security-credentials/)
|
INSTANCE_PROFILE=$(curl -s -m 1 http://169.254.169.254/latest/meta-data/iam/security-credentials/)
|
||||||
|
if echo "$INSTANCE_PROFILE" | grep -q '404 - Not Found'; then
|
||||||
|
INSTANCE_PROFILE=
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ $PROFILE ]]; then
|
if [[ $PROFILE ]]; then
|
||||||
PROFILE_OPT="--profile $PROFILE"
|
PROFILE_OPT="--profile $PROFILE"
|
||||||
@@ -274,6 +277,16 @@ if [ -z "${AWSCLI}" ]; then
|
|||||||
exit $EXITCODE
|
exit $EXITCODE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Set default region by aws config, fall back to us-east-1
|
||||||
|
REGION_CONFIG=$(aws configure get region)
|
||||||
|
if [[ $REGION_OPT ]]; then
|
||||||
|
REGION="$REGION_OPT"
|
||||||
|
elif [[ $REGION_CONFIG ]]; then
|
||||||
|
REGION="$REGION_CONFIG"
|
||||||
|
else
|
||||||
|
REGION="us-east-1"
|
||||||
|
fi
|
||||||
|
|
||||||
TITLE_ID=""
|
TITLE_ID=""
|
||||||
TITLE_TEXT="CALLER ERROR - UNSET TITLE"
|
TITLE_TEXT="CALLER ERROR - UNSET TITLE"
|
||||||
## Output formatting functions
|
## Output formatting functions
|
||||||
|
|||||||
Reference in New Issue
Block a user