Improved html output with scoring information

This commit is contained in:
Toni de la Fuente
2021-04-08 00:14:24 +02:00
parent dacfea6b32
commit 3dfca9c9dd
3 changed files with 66 additions and 17 deletions

View File

@@ -139,6 +139,14 @@ bsd_test_tcp_connectivity() {
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
if [ "$OSTYPE" == "linux-gnu" ] || [ "$OSTYPE" == "linux-musl" ]; then
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() {
gnu_convert_date_to_timestamp "$1"
}
replace_sed() {
gnu_replace_sed $1 $2
}
elif [[ "$OSTYPE" == "darwin"* ]] || [[ "$OSTYPE" == "freebsd"* ]]; then
# BSD/OSX commands compatibility
TEMP_REPORT_FILE=$(mktemp -t prowler.cred_report-XXXXXX)
@@ -244,6 +256,9 @@ elif [[ "$OSTYPE" == "darwin"* ]] || [[ "$OSTYPE" == "freebsd"* ]]; then
test_tcp_connectivity() {
bsd_test_tcp_connectivity "$1" "$2" "$3"
}
replace_sed() {
bsd_replace_sed $1 $2
}
elif [[ "$OSTYPE" == "cygwin" ]]; then
# POSIX compatibility layer and Linux environment emulation for Windows
TEMP_REPORT_FILE=$(mktemp -t -p /tmp prowler.cred_report-XXXXXX)
@@ -274,6 +289,9 @@ elif [[ "$OSTYPE" == "cygwin" ]]; then
convert_date_to_timestamp() {
gnu_convert_date_to_timestamp "$1"
}
replace_sed() {
gnu_replace_sed $1 $2
}
else
echo "Unknown Operating System! Valid \$OSTYPE: linux-gnu, linux-musl, darwin* or cygwin"
echo "Found: $OSTYPE"