From fa72e7c21fbf3e681827873e81f95c0199773793 Mon Sep 17 00:00:00 2001 From: nikirby Date: Fri, 20 Nov 2020 15:16:22 -0500 Subject: [PATCH] Ensures JSON is the default AWS command output. --- prowler | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/prowler b/prowler index c88fab83..6293c257 100755 --- a/prowler +++ b/prowler @@ -51,6 +51,15 @@ TITLE_TEXT="CALLER ERROR - UNSET TITLE" WHITELIST_FILE="" TOTAL_CHECKS=() +# Ensures command output will always be set to JSON. +# If the default value is already set, ORIGINAL_OUTPUT will be used to store it and reset it at cleanup +if [[ -z "${AWS_DEFAULT_OUTPUT}" ]]; then + ORIGINAL_OUTPUT=$AWS_DEFAULT_OUTPUT + export AWS_DEFAULT_OUTPUT="json" +else + export AWS_DEFAULT_OUTPUT="json" +fi + # Command usage menu usage(){ echo " @@ -200,6 +209,12 @@ clean_up() { if [[ "${MODES[@]}" =~ "html" ]]; then addHtmlFooter >> ${OUTPUT_FILE_NAME}.$EXTENSION_HTML fi + # puts the AWS_DEFAULT_OUTPUT back to what it was at the start + if [ -z "$ORIGINAL_OUTPUT"]; then + export AWS_DEFAULT_OUTPUT="$ORIGINAL_OUTPUT" + else + unset AWS_DEFAULT_OUTPUT + fi } handle_ctrl_c() {