mirror of
https://github.com/ghndrx/prowler.git
synced 2026-02-10 23:05:05 +00:00
Improved html output with scoring information
This commit is contained in:
@@ -55,18 +55,18 @@ addHtmlHeader() {
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<title>Prowler - AWS Security Assesments</title>
|
<title>Prowler - AWS Security Assessments</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<nav class="navbar navbar-expand-xl sticky-top navbar-dark bg-dark">
|
<nav class="navbar navbar-expand-xl sticky-top navbar-dark bg-dark">
|
||||||
<a class="navbar-brand" href="#">Prowler - Security Assesments in AWS</a>
|
<a class="navbar-brand" href="#">Prowler - Security Assessments in AWS</a>
|
||||||
</nav>
|
</nav>
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="row mt-3">
|
<div class="row mt-3">
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
Report Information
|
Report Information:
|
||||||
</div>
|
</div>
|
||||||
<ul class="list-group list-group-flush">
|
<ul class="list-group list-group-flush">
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
@@ -90,10 +90,10 @@ addHtmlHeader() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-8">
|
<div class="col-md-4">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
Assesment Summary
|
Assessment Summary:
|
||||||
</div>
|
</div>
|
||||||
<ul class="list-group list-group-flush">
|
<ul class="list-group list-group-flush">
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
@@ -114,6 +114,30 @@ addHtmlHeader() {
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
Scoring Information:
|
||||||
|
</div>
|
||||||
|
<ul class="list-group list-group-flush">
|
||||||
|
<li class="list-group-item">
|
||||||
|
<b>Prowler Score:</b> PROWLER_SCORE%
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<b>Total Resources:</b> TOTAL_RESOURCES
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<b>Passed:</b> PASS_COUNTER
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<b>Failed:</b> FAIL_COUNTER
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<b>Total Checks Executed:</b> CHECKS_COUNTER
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row mt-3">
|
<div class="row mt-3">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
|
|||||||
@@ -139,6 +139,14 @@ bsd_test_tcp_connectivity() {
|
|||||||
nc -z -G $TIMEOUT $HOST $PORT >/dev/null 2>&1 && echo "200" || echo "000"
|
nc -z -G $TIMEOUT $HOST $PORT >/dev/null 2>&1 && echo "200" || echo "000"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gnu_replace_sed(){
|
||||||
|
sed -i $1 $2
|
||||||
|
}
|
||||||
|
|
||||||
|
bsd_replace_sed(){
|
||||||
|
sed -i '' $1 $2
|
||||||
|
}
|
||||||
|
|
||||||
# Functions to manage dates depending on OS
|
# Functions to manage dates depending on OS
|
||||||
if [ "$OSTYPE" == "linux-gnu" ] || [ "$OSTYPE" == "linux-musl" ]; then
|
if [ "$OSTYPE" == "linux-gnu" ] || [ "$OSTYPE" == "linux-musl" ]; then
|
||||||
TEMP_REPORT_FILE=$(mktemp -t -p /tmp prowler.cred_report-XXXXXX)
|
TEMP_REPORT_FILE=$(mktemp -t -p /tmp prowler.cred_report-XXXXXX)
|
||||||
@@ -171,6 +179,10 @@ if [ "$OSTYPE" == "linux-gnu" ] || [ "$OSTYPE" == "linux-musl" ]; then
|
|||||||
convert_date_to_timestamp() {
|
convert_date_to_timestamp() {
|
||||||
gnu_convert_date_to_timestamp "$1"
|
gnu_convert_date_to_timestamp "$1"
|
||||||
}
|
}
|
||||||
|
replace_sed() {
|
||||||
|
gnu_replace_sed $1 $2
|
||||||
|
}
|
||||||
|
|
||||||
elif [[ "$OSTYPE" == "darwin"* ]] || [[ "$OSTYPE" == "freebsd"* ]]; then
|
elif [[ "$OSTYPE" == "darwin"* ]] || [[ "$OSTYPE" == "freebsd"* ]]; then
|
||||||
# BSD/OSX commands compatibility
|
# BSD/OSX commands compatibility
|
||||||
TEMP_REPORT_FILE=$(mktemp -t prowler.cred_report-XXXXXX)
|
TEMP_REPORT_FILE=$(mktemp -t prowler.cred_report-XXXXXX)
|
||||||
@@ -244,6 +256,9 @@ elif [[ "$OSTYPE" == "darwin"* ]] || [[ "$OSTYPE" == "freebsd"* ]]; then
|
|||||||
test_tcp_connectivity() {
|
test_tcp_connectivity() {
|
||||||
bsd_test_tcp_connectivity "$1" "$2" "$3"
|
bsd_test_tcp_connectivity "$1" "$2" "$3"
|
||||||
}
|
}
|
||||||
|
replace_sed() {
|
||||||
|
bsd_replace_sed $1 $2
|
||||||
|
}
|
||||||
elif [[ "$OSTYPE" == "cygwin" ]]; then
|
elif [[ "$OSTYPE" == "cygwin" ]]; then
|
||||||
# POSIX compatibility layer and Linux environment emulation for Windows
|
# POSIX compatibility layer and Linux environment emulation for Windows
|
||||||
TEMP_REPORT_FILE=$(mktemp -t -p /tmp prowler.cred_report-XXXXXX)
|
TEMP_REPORT_FILE=$(mktemp -t -p /tmp prowler.cred_report-XXXXXX)
|
||||||
@@ -274,6 +289,9 @@ elif [[ "$OSTYPE" == "cygwin" ]]; then
|
|||||||
convert_date_to_timestamp() {
|
convert_date_to_timestamp() {
|
||||||
gnu_convert_date_to_timestamp "$1"
|
gnu_convert_date_to_timestamp "$1"
|
||||||
}
|
}
|
||||||
|
replace_sed() {
|
||||||
|
gnu_replace_sed $1 $2
|
||||||
|
}
|
||||||
else
|
else
|
||||||
echo "Unknown Operating System! Valid \$OSTYPE: linux-gnu, linux-musl, darwin* or cygwin"
|
echo "Unknown Operating System! Valid \$OSTYPE: linux-gnu, linux-musl, darwin* or cygwin"
|
||||||
echo "Found: $OSTYPE"
|
echo "Found: $OSTYPE"
|
||||||
|
|||||||
@@ -13,19 +13,19 @@
|
|||||||
|
|
||||||
# Scoring POC
|
# Scoring POC
|
||||||
scoring(){
|
scoring(){
|
||||||
|
if [[ ! $PASS_COUNTER ]]; then
|
||||||
|
PASS_COUNTER=0
|
||||||
|
fi
|
||||||
|
if [[ ! $FAIL_COUNTER ]]; then
|
||||||
|
FAIL_COUNTER=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# TOTAL_RESOURCES=$(awk "BEGIN {print $FAIL_COUNTER+$PASS_COUNTER; exit}")
|
||||||
|
TOTAL_RESOURCES=$(($FAIL_COUNTER + $PASS_COUNTER))
|
||||||
|
# Score is % of passed compared to failures. The higher score, the better
|
||||||
|
PROWLER_SCORE=$(( $PASS_COUNTER * 100 / $TOTAL_RESOURCES ))
|
||||||
|
|
||||||
if [[ $SCORING == "1" ]]; then
|
if [[ $SCORING == "1" ]]; then
|
||||||
if [[ ! $PASS_COUNTER ]]; then
|
|
||||||
PASS_COUNTER=0
|
|
||||||
fi
|
|
||||||
if [[ ! $FAIL_COUNTER ]]; then
|
|
||||||
FAIL_COUNTER=0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# TOTAL_RESOURCES=$(awk "BEGIN {print $FAIL_COUNTER+$PASS_COUNTER; exit}")
|
|
||||||
TOTAL_RESOURCES=$(($FAIL_COUNTER + $PASS_COUNTER))
|
|
||||||
# Score is % of passed compared to failures. The higher score, the better
|
|
||||||
PROWLER_SCORE=$(( $PASS_COUNTER * 100 / $TOTAL_RESOURCES ))
|
|
||||||
|
|
||||||
echo -e "$BLUE------------------------------------------------------------------ $NORMAL"
|
echo -e "$BLUE------------------------------------------------------------------ $NORMAL"
|
||||||
echo -e "$CYAN _"
|
echo -e "$CYAN _"
|
||||||
echo -e " _ __ _ __ _____ _| | ___ _ __"
|
echo -e " _ __ _ __ _____ _| | ___ _ __"
|
||||||
@@ -49,5 +49,12 @@ scoring(){
|
|||||||
echo -e "$BLUE------------------------------------------------------------------ $NORMAL"
|
echo -e "$BLUE------------------------------------------------------------------ $NORMAL"
|
||||||
echo -e " * the highest the better (0 to 100)$NORMAL"
|
echo -e " * the highest the better (0 to 100)$NORMAL"
|
||||||
echo -e " Prowler scoring uses any check, including CIS not scored checks$NORMAL"
|
echo -e " Prowler scoring uses any check, including CIS not scored checks$NORMAL"
|
||||||
|
fi
|
||||||
|
if [[ "${MODES[@]}" =~ "html" ]]; then
|
||||||
|
replace_sed 's/PROWLER_SCORE/'$PROWLER_SCORE'/g' ${OUTPUT_FILE_NAME}.$EXTENSION_HTML
|
||||||
|
replace_sed 's/PASS_COUNTER/'$PASS_COUNTER'/g' ${OUTPUT_FILE_NAME}.$EXTENSION_HTML
|
||||||
|
replace_sed 's/TOTAL_RESOURCES/'$TOTAL_RESOURCES'/g' ${OUTPUT_FILE_NAME}.$EXTENSION_HTML
|
||||||
|
replace_sed 's/FAIL_COUNTER/'$FAIL_COUNTER'/g' ${OUTPUT_FILE_NAME}.$EXTENSION_HTML
|
||||||
|
replace_sed 's/CHECKS_COUNTER/'$CHECKS_COUNTER'/g' ${OUTPUT_FILE_NAME}.$EXTENSION_HTML
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user