Skip to content

Commit

Permalink
Merge pull request #58 from MrSecure/parallelism
Browse files Browse the repository at this point in the history
Parallelism Tweaks
  • Loading branch information
toniblyx authored Jul 11, 2017
2 parents 96ec896 + cdbcac5 commit 59c8c8a
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions prowler
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ textOK(){
else
REPREGION=$REGION
fi
echo "$PROFILE${SEP}$REPREGION${SEP}$TITLE_ID${SEP}PASS${SEP}$ITEM_SCORED${SEP}$TITLE_TEXT${SEP}$1"
echo "$PROFILE${SEP}$ACCOUNT_NUM${SEP}$REPREGION${SEP}$TITLE_ID${SEP}PASS${SEP}$ITEM_SCORED${SEP}$TITLE_TEXT${SEP}$1"
else
echo " $OK OK! $NORMAL $1"
fi
Expand All @@ -263,7 +263,7 @@ textNotice(){
else
REPREGION=$REGION
fi
echo "$PROFILE${SEP}$REPREGION${SEP}$TITLE_ID${SEP}INFO${SEP}$ITEM_SCORED${SEP}$TITLE_TEXT${SEP}$1"
echo "$PROFILE${SEP}$ACCOUNT_NUM${SEP}$REPREGION${SEP}$TITLE_ID${SEP}INFO${SEP}$ITEM_SCORED${SEP}$TITLE_TEXT${SEP}$1"
else
echo " $NOTICE INFO! $1 $NORMAL"
fi
Expand All @@ -276,7 +276,7 @@ textWarn(){
else
REPREGION=$REGION
fi
echo "$PROFILE${SEP}$REPREGION${SEP}$TITLE_ID${SEP}WARNING${SEP}$ITEM_SCORED${SEP}$TITLE_TEXT${SEP}$1"
echo "$PROFILE${SEP}$ACCOUNT_NUM${SEP}$REPREGION${SEP}$TITLE_ID${SEP}WARNING${SEP}$ITEM_SCORED${SEP}$TITLE_TEXT${SEP}$1"
else
echo " $BAD WARNING! $1 $NORMAL"
fi
Expand Down Expand Up @@ -307,9 +307,9 @@ printCsvHeader() {
>&2 echo ""
>&2 echo ""
>&2 echo "Generating \"${SEP}\" delimited report on stdout; Diagnostics on stderr."
>&2 echo " Using Profile $PROFILE"
>&2 echo " Using Profile $PROFILE, Account $ACCOUNT_NUM"
>&2 echo ""
echo "PROFILE${SEP}REGION${SEP}TITLE_ID${SEP}RESULT${SEP}SCORED${SEP}TITLE_TEXT${SEP}NOTES"
echo "PROFILE${SEP}ACCOUNT_NUM${SEP}REGION${SEP}TITLE_ID${SEP}RESULT${SEP}SCORED${SEP}TITLE_TEXT${SEP}NOTES"
}

prowlerBanner() {
Expand All @@ -323,6 +323,7 @@ prowlerBanner() {

# Get whoami in AWS, who is the user running this shell script
getWhoami(){
ACCOUNT_NUM=$($AWSCLI sts get-caller-identity --output json --profile $PROFILE --region $REGION --query "Account" | tr -d '"')
if [[ $MODE == "csv" ]]; then
CALLER_ARN=$($AWSCLI sts get-caller-identity --output json --profile $PROFILE --region $REGION --query "Arn" | tr -d '"')
textTitle "0.0" "Show report generation info"
Expand Down Expand Up @@ -362,7 +363,7 @@ genCredReport() {

# Save report to a file, decode it, deletion at finish and after every single check, acb stands for AWS CIS Benchmark
saveReport(){
TEMP_REPORT_FILE=/tmp/.acb
TEMP_REPORT_FILE=$(mktemp -t prowler-XXXXX.cred_report )
$AWSCLI iam get-credential-report --query 'Content' --output text --profile $PROFILE --region $REGION | decode_report > $TEMP_REPORT_FILE
}

Expand All @@ -371,6 +372,9 @@ cleanTemp(){
rm -fr $TEMP_REPORT_FILE
}

# Delete the temporary report file if we get interrupted/terminated
trap cleanTemp SIGHUP SIGINT SIGTERM

# Get a list of all available AWS Regions
REGIONS=$($AWSCLI ec2 describe-regions --query 'Regions[].RegionName' \
--output text \
Expand Down

0 comments on commit 59c8c8a

Please sign in to comment.