From a3a23eb8dcae095207aeef1de4875fd8e2f0ffb0 Mon Sep 17 00:00:00 2001 From: Ben Allen Date: Mon, 26 Jun 2017 10:54:12 -0500 Subject: [PATCH] move output formatting functions up in file; use them earlier --- prowler | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/prowler b/prowler index 5b52344e..241150ff 100755 --- a/prowler +++ b/prowler @@ -240,6 +240,20 @@ fi # AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} # AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY_ID} +## Output formatting functions +text_ok(){ + echo " $OK OK! $NORMAL $@" +} + +text_notice(){ + echo " $NOTICE NOTICE! $@ $NORMAL" +} + +text_warn(){ + echo " $WARNING WARNING! $@ $NORMAL" +} + + prowlerBanner() { echo -e "$CYAN _" echo -e " _ __ _ __ _____ _| | ___ _ __" @@ -265,8 +279,7 @@ getWhoami(){ } printCurrentDate(){ - echo "" - echo "Date: ${NOTICE}$(date)${NORMAL}" + text_notice "Date: $(date)" } printColorsCode(){ @@ -304,27 +317,13 @@ REGIONS=$($AWSCLI ec2 describe-regions --query 'Regions[].RegionName' \ infoReferenceLong(){ # Report review note: - echo -e " $BLUE \n*********************************$NORMAL" - echo -e " $NOTICE For more information: $NORMAL" - echo -e " $NOTICE https://benchmarks.cisecurity.org/tools2/amazon/CIS_Amazon_Web_Services_Foundations_Benchmark_v1.1.0.pdf$NORMAL" - echo -e " $NOTICE For bugs or feedback: $NORMAL" - echo -e " $NOTICE https://github.com/Alfresco/aws-cis-security-benchmark/issues$NORMAL" + text_notice "For more information:" + text_notice "https://benchmarks.cisecurity.org/tools2/amazon/CIS_Amazon_Web_Services_Foundations_Benchmark_v1.1.0.pdf" + text_notice "For bugs or feedback:" + text_notice "https://github.com/Alfresco/aws-cis-security-benchmark/issues" } - -text_ok(){ - echo " $OK OK! $NORMAL $@" -} - -text_notice(){ - echo " $NOTICE NOTICE! $@ $NORMAL" -} - -text_warn(){ - echo " $WARNING WARNING! $@ $NORMAL" -} - infoReferenceShort(){ # Report review note: text_notice "http://bit.ly/2g3PEf7" @@ -351,7 +350,7 @@ check12(){ echo -e " List of users with Password enabled but MFA disabled:" echo -e " $BAD WARNING! $COMMAND12 $NORMAL" else - text_ok " No users found with Password enabled and MFA disabled" + text_ok "No users found with Password enabled and MFA disabled" fi }