diff --git a/checks/check_extra713 b/checks/check_extra713 index ecd5239e..6a493804 100644 --- a/checks/check_extra713 +++ b/checks/check_extra713 @@ -21,13 +21,14 @@ extra713(){ # Guardduty Regions are not the same as REGIONS PYTHON=$(which python) if [ ! -z "${PYTHON}" ]; then - GD_REGIONS=$($PYTHON -c "import boto3 ; session = boto3.session.Session() ; print (session.get_available_regions('guardduty'))") + GD_REGIONS=($($PYTHON -c "import boto3 ; session = boto3.session.Session() ; print (session.get_available_regions('guardduty'))")) else GD_REGIONS=$REGIONS fi # "Check if GuardDuty is enabled (Not Scored) (Not part of CIS benchmark)" - for regx in $GD_REGIONS; do + for GD_REGION in "${GD_REGIONS[@]}"; do + regx="$(echo "$GD_REGION" | cut -d \' -f 2 | cut -d \' -f 1)" LIST_OF_GUARDDUTY_DETECTORS=$($AWSCLI guardduty list-detectors $PROFILE_OPT --region $regx --output text 2> /dev/null | cut -f2) if [[ $LIST_OF_GUARDDUTY_DETECTORS ]];then while read -r detector;do