Ensures JSON is the default AWS command output.

This commit is contained in:
nikirby
2020-11-20 15:16:22 -05:00
parent b702990ea6
commit fa72e7c21f

15
prowler
View File

@@ -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() {