mirror of
https://github.com/drwetter/testssl.sh.git
synced 2025-01-06 00:39:44 +01:00
~Empty files when scan problems encountered
This commit addresses #934. It adds a line in the log/csv output and a json object named "scanProblem" when either the function fatal() is being called and it logs the reason of the fatal error.
This commit is contained in:
parent
7ffd46447a
commit
ef6deb037e
13
testssl.sh
13
testssl.sh
@ -431,7 +431,7 @@ set_severity_level() {
|
||||
elif [[ "$severity" == CRITICAL ]]; then
|
||||
SEVERITY_LEVEL=$CRITICAL
|
||||
else
|
||||
# WARN will always be logged
|
||||
# WARN and FATAL will always be logged as the represent scanning problems
|
||||
echo "Supported severity levels are LOW, MEDIUM, HIGH, CRITICAL!"
|
||||
help 1
|
||||
fi
|
||||
@ -446,8 +446,9 @@ show_finding() {
|
||||
( [[ "$severity" == LOW ]] && [[ $SEVERITY_LEVEL -le $LOW ]] ) ||
|
||||
( [[ "$severity" == MEDIUM ]] && [[ $SEVERITY_LEVEL -le $MEDIUM ]] ) ||
|
||||
( [[ "$severity" == HIGH ]] && [[ $SEVERITY_LEVEL -le $HIGH ]] ) ||
|
||||
( [[ "$severity" == CRITICAL ]] && [[ $SEVERITY_LEVEL -le $CRITICAL ]] ) ||
|
||||
( [[ "$severity" == WARN ]] ) ||
|
||||
( [[ "$severity" == CRITICAL ]] && [[ $SEVERITY_LEVEL -le $CRITICAL ]] )
|
||||
( [[ "$severity" == FATAL ]] )
|
||||
}
|
||||
|
||||
########### Output functions
|
||||
@ -16252,8 +16253,12 @@ child_error() {
|
||||
fatal() {
|
||||
outln
|
||||
prln_magenta "Fatal error: $1" >&2
|
||||
[[ -n "$3" ]] && outln "$3" >&2
|
||||
fileout "fatal_error" "ERROR" "$1"
|
||||
[[ -n "$LOGFILE" ]] && prln_magenta "Fatal error: $1" >>$LOGFILE
|
||||
if [[ -n "$3" ]]; then
|
||||
outln "$3" >&2
|
||||
[[ -n "$LOGFILE" ]] && outln "$3" >>$LOGFILE
|
||||
fi
|
||||
fileout "scanProblem" "FATAL" "$1"
|
||||
exit $2
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user