mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-11 07:15:15 +00:00
Added account id to the output filename
This commit is contained in:
@@ -13,13 +13,19 @@
|
|||||||
|
|
||||||
# Output formatting functions
|
# Output formatting functions
|
||||||
|
|
||||||
|
# if [[ $ACCOUNT_TO_ASSUME ]];then
|
||||||
|
# ACCOUNT_ID="$ACCOUNT_TO_ASSUME"
|
||||||
|
# else
|
||||||
|
# ACCOUNT_ID="$ACCOUNT_NUM"
|
||||||
|
# fi
|
||||||
|
|
||||||
|
|
||||||
EXTENSION_CSV="csv"
|
EXTENSION_CSV="csv"
|
||||||
EXTENSION_JSON="json"
|
EXTENSION_JSON="json"
|
||||||
EXTENSION_ASFF="asff-json"
|
EXTENSION_ASFF="asff-json"
|
||||||
EXTENSION_HTML="html" # not implemented yet, use ansi2html as in documentation
|
EXTENSION_HTML="html" # not implemented yet, use ansi2html as in documentation
|
||||||
OUTPUT_DATE=$(date -u +"%Y%m%d%H%M%S")
|
OUTPUT_DATE=$(date -u +"%Y%m%d%H%M%S")
|
||||||
OUTPUT_FILE_NAME=prowler-output-$OUTPUT_DATE
|
OUTPUT_FILE_NAME="prowler-output-${ACCOUNT_NUM}-${OUTPUT_DATE}"
|
||||||
|
|
||||||
|
|
||||||
textPass(){
|
textPass(){
|
||||||
if [[ "$QUIET" == 1 ]]; then
|
if [[ "$QUIET" == 1 ]]; then
|
||||||
@@ -33,10 +39,10 @@ textPass(){
|
|||||||
REPREGION=$REGION
|
REPREGION=$REGION
|
||||||
fi
|
fi
|
||||||
if [[ "${MODES[@]}" =~ "csv" ]]; then
|
if [[ "${MODES[@]}" =~ "csv" ]]; then
|
||||||
echo "$PROFILE${SEP}$ACCOUNT_NUM${SEP}$REPREGION${SEP}$TITLE_ID${SEP}PASS${SEP}$ITEM_SCORED${SEP}$ITEM_LEVEL${SEP}$TITLE_TEXT${SEP}$1" | tee -a $OUTPUT_FILE_NAME.$EXTENSION_CSV
|
echo "$PROFILE${SEP}$ACCOUNT_NUM${SEP}$REPREGION${SEP}$TITLE_ID${SEP}PASS${SEP}$ITEM_SCORED${SEP}$ITEM_LEVEL${SEP}$TITLE_TEXT${SEP}$1" | tee -a ${OUTPUT_FILE_NAME}.$EXTENSION_CSV
|
||||||
fi
|
fi
|
||||||
if [[ "${MODES[@]}" =~ "json" ]]; then
|
if [[ "${MODES[@]}" =~ "json" ]]; then
|
||||||
generateJsonOutput "$1" "Pass" | tee -a $OUTPUT_FILE_NAME.$EXTENSION_JSON
|
generateJsonOutput "$1" "Pass" | tee -a ${OUTPUT_FILE_NAME}.$EXTENSION_JSON
|
||||||
fi
|
fi
|
||||||
if [[ "${MODES[@]}" =~ "json-asff" ]]; then
|
if [[ "${MODES[@]}" =~ "json-asff" ]]; then
|
||||||
JSON_ASFF_OUTPUT=$(generateJsonAsffOutput "$1" "PASSED" "INFORMATIONAL")
|
JSON_ASFF_OUTPUT=$(generateJsonAsffOutput "$1" "PASSED" "INFORMATIONAL")
|
||||||
@@ -64,10 +70,10 @@ textInfo(){
|
|||||||
REPREGION=$REGION
|
REPREGION=$REGION
|
||||||
fi
|
fi
|
||||||
if [[ "${MODES[@]}" =~ "csv" ]]; then
|
if [[ "${MODES[@]}" =~ "csv" ]]; then
|
||||||
echo "$PROFILE${SEP}$ACCOUNT_NUM${SEP}$REPREGION${SEP}$TITLE_ID${SEP}INFO${SEP}$ITEM_SCORED${SEP}$ITEM_LEVEL${SEP}$TITLE_TEXT${SEP}$1" | tee -a $OUTPUT_FILE_NAME.$EXTENSION_CSV
|
echo "$PROFILE${SEP}$ACCOUNT_NUM${SEP}$REPREGION${SEP}$TITLE_ID${SEP}INFO${SEP}$ITEM_SCORED${SEP}$ITEM_LEVEL${SEP}$TITLE_TEXT${SEP}$1" | tee -a ${OUTPUT_FILE_NAME}.${EXTENSION_CSV}
|
||||||
fi
|
fi
|
||||||
if [[ "${MODES[@]}" =~ "json" ]]; then
|
if [[ "${MODES[@]}" =~ "json" ]]; then
|
||||||
generateJsonOutput "$1" "Info" | tee -a $OUTPUT_FILE_NAME.$EXTENSION_JSON
|
generateJsonOutput "$1" "Info" | tee -a ${OUTPUT_FILE_NAME}.${EXTENSION_JSON}
|
||||||
fi
|
fi
|
||||||
if is_junit_output_enabled; then
|
if is_junit_output_enabled; then
|
||||||
output_junit_info "$1"
|
output_junit_info "$1"
|
||||||
@@ -86,14 +92,14 @@ textFail(){
|
|||||||
REPREGION=$REGION
|
REPREGION=$REGION
|
||||||
fi
|
fi
|
||||||
if [[ "${MODES[@]}" =~ "csv" ]]; then
|
if [[ "${MODES[@]}" =~ "csv" ]]; then
|
||||||
echo "$PROFILE${SEP}$ACCOUNT_NUM${SEP}$REPREGION${SEP}$TITLE_ID${SEP}FAIL${SEP}$ITEM_SCORED${SEP}$ITEM_LEVEL${SEP}$TITLE_TEXT${SEP}$1" | tee -a $OUTPUT_FILE_NAME.$EXTENSION_CSV
|
echo "$PROFILE${SEP}$ACCOUNT_NUM${SEP}$REPREGION${SEP}$TITLE_ID${SEP}FAIL${SEP}$ITEM_SCORED${SEP}$ITEM_LEVEL${SEP}$TITLE_TEXT${SEP}$1" | tee -a ${OUTPUT_FILE_NAME}.${EXTENSION_CSV}
|
||||||
fi
|
fi
|
||||||
if [[ "${MODES[@]}" =~ "json" ]]; then
|
if [[ "${MODES[@]}" =~ "json" ]]; then
|
||||||
generateJsonOutput "$1" "Fail" | tee -a $OUTPUT_FILE_NAME.$EXTENSION_JSON
|
generateJsonOutput "$1" "Fail" | tee -a ${OUTPUT_FILE_NAME}.${EXTENSION_JSON}
|
||||||
fi
|
fi
|
||||||
if [[ "${MODES[@]}" =~ "json-asff" ]]; then
|
if [[ "${MODES[@]}" =~ "json-asff" ]]; then
|
||||||
JSON_ASFF_OUTPUT=$(generateJsonAsffOutput "$1" "FAILED" "HIGH")
|
JSON_ASFF_OUTPUT=$(generateJsonAsffOutput "$1" "FAILED" "HIGH")
|
||||||
echo "${JSON_ASFF_OUTPUT}" | tee -a $OUTPUT_FILE_NAME.$EXTENSION_ASFF
|
echo "${JSON_ASFF_OUTPUT}" | tee -a ${OUTPUT_FILE_NAME}.${EXTENSION_ASFF}
|
||||||
if [[ "${SEND_TO_SECURITY_HUB}" -eq 1 ]]; then
|
if [[ "${SEND_TO_SECURITY_HUB}" -eq 1 ]]; then
|
||||||
sendToSecurityHub "${JSON_ASFF_OUTPUT}"
|
sendToSecurityHub "${JSON_ASFF_OUTPUT}"
|
||||||
fi
|
fi
|
||||||
@@ -142,7 +148,7 @@ textTitle(){
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${MODES[@]}" =~ "csv" ]]; then
|
if [[ "${MODES[@]}" =~ "csv" ]]; then
|
||||||
>&2 echo "$TITLE_ID $TITLE_TEXT" | tee -a $OUTPUT_FILE_NAME.$EXTENSION_CSV
|
>&2 echo "$TITLE_ID $TITLE_TEXT" | tee -a ${OUTPUT_FILE_NAME}.${EXTENSION_CSV}
|
||||||
elif [[ "${MODES[@]}" =~ "json" || "${MODES[@]}" =~ "json-asff" ]]; then
|
elif [[ "${MODES[@]}" =~ "json" || "${MODES[@]}" =~ "json-asff" ]]; then
|
||||||
:
|
:
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user