mirror of
https://github.com/drwetter/testssl.sh.git
synced 2025-01-07 17:20:57 +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
|
elif [[ "$severity" == CRITICAL ]]; then
|
||||||
SEVERITY_LEVEL=$CRITICAL
|
SEVERITY_LEVEL=$CRITICAL
|
||||||
else
|
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!"
|
echo "Supported severity levels are LOW, MEDIUM, HIGH, CRITICAL!"
|
||||||
help 1
|
help 1
|
||||||
fi
|
fi
|
||||||
@ -446,8 +446,9 @@ show_finding() {
|
|||||||
( [[ "$severity" == LOW ]] && [[ $SEVERITY_LEVEL -le $LOW ]] ) ||
|
( [[ "$severity" == LOW ]] && [[ $SEVERITY_LEVEL -le $LOW ]] ) ||
|
||||||
( [[ "$severity" == MEDIUM ]] && [[ $SEVERITY_LEVEL -le $MEDIUM ]] ) ||
|
( [[ "$severity" == MEDIUM ]] && [[ $SEVERITY_LEVEL -le $MEDIUM ]] ) ||
|
||||||
( [[ "$severity" == HIGH ]] && [[ $SEVERITY_LEVEL -le $HIGH ]] ) ||
|
( [[ "$severity" == HIGH ]] && [[ $SEVERITY_LEVEL -le $HIGH ]] ) ||
|
||||||
|
( [[ "$severity" == CRITICAL ]] && [[ $SEVERITY_LEVEL -le $CRITICAL ]] ) ||
|
||||||
( [[ "$severity" == WARN ]] ) ||
|
( [[ "$severity" == WARN ]] ) ||
|
||||||
( [[ "$severity" == CRITICAL ]] && [[ $SEVERITY_LEVEL -le $CRITICAL ]] )
|
( [[ "$severity" == FATAL ]] )
|
||||||
}
|
}
|
||||||
|
|
||||||
########### Output functions
|
########### Output functions
|
||||||
@ -16252,8 +16253,12 @@ child_error() {
|
|||||||
fatal() {
|
fatal() {
|
||||||
outln
|
outln
|
||||||
prln_magenta "Fatal error: $1" >&2
|
prln_magenta "Fatal error: $1" >&2
|
||||||
[[ -n "$3" ]] && outln "$3" >&2
|
[[ -n "$LOGFILE" ]] && prln_magenta "Fatal error: $1" >>$LOGFILE
|
||||||
fileout "fatal_error" "ERROR" "$1"
|
if [[ -n "$3" ]]; then
|
||||||
|
outln "$3" >&2
|
||||||
|
[[ -n "$LOGFILE" ]] && outln "$3" >>$LOGFILE
|
||||||
|
fi
|
||||||
|
fileout "scanProblem" "FATAL" "$1"
|
||||||
exit $2
|
exit $2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user