mirror of
https://github.com/drwetter/testssl.sh.git
synced 2025-01-03 23:39:45 +01:00
- changed performance debugging options (small solution) so that the last delta is being shown
- PS4 improved: has now a performance debugging options (big solution) - PS4 with proper alignment - SCAN_TIME is now global so that it can be used not only by JSON-PRETTY (small performance debugging options uses it) - prepare_debug() has now debugging stuff only, rest went to prepare_arrays()
This commit is contained in:
parent
8c0b0083d0
commit
27d0570fb5
38
testssl.sh
38
testssl.sh
@ -78,7 +78,8 @@
|
|||||||
|
|
||||||
|
|
||||||
# debugging help:
|
# debugging help:
|
||||||
readonly PS4='${LINENO}> ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
|
#readonly PS4='${LINENO}> $(date "+%s.%N")\011 ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
|
||||||
|
readonly PS4='|$(date "+%s.%N")\011${LINENO}>\011${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
|
||||||
|
|
||||||
# make sure that temporary files are cleaned up after use in ANY case
|
# make sure that temporary files are cleaned up after use in ANY case
|
||||||
trap "cleanup" QUIT EXIT
|
trap "cleanup" QUIT EXIT
|
||||||
@ -260,14 +261,16 @@ GET_REQ11=""
|
|||||||
readonly UA_STD="TLS tester from $SWURL"
|
readonly UA_STD="TLS tester from $SWURL"
|
||||||
readonly UA_SNEAKY="Mozilla/5.0 (X11; Linux x86_64; rv:41.0) Gecko/20100101 Firefox/41.0"
|
readonly UA_SNEAKY="Mozilla/5.0 (X11; Linux x86_64; rv:41.0) Gecko/20100101 Firefox/41.0"
|
||||||
FIRST_FINDING=true # Is this the first finding we are outputting to file?
|
FIRST_FINDING=true # Is this the first finding we are outputting to file?
|
||||||
START_TIME=0
|
START_TIME=0 # time in epoch when the action started
|
||||||
END_TIME=0
|
END_TIME=0 # .. ended
|
||||||
|
SCAN_TIME=0 # diff of both: total scan time
|
||||||
|
LAST_TIME=0 # only used for performance measurements (MEASURE_TIME=true)
|
||||||
|
|
||||||
# Devel stuff, see -q below
|
# Devel stuff, see -q below
|
||||||
TLS_LOW_BYTE=""
|
TLS_LOW_BYTE=""
|
||||||
HEX_CIPHER=""
|
HEX_CIPHER=""
|
||||||
|
|
||||||
SERVER_COUNTER=0 # Counter for multiple servers
|
SERVER_COUNTER=0 # Counter for multiple servers
|
||||||
|
|
||||||
#################### SEVERITY ####################
|
#################### SEVERITY ####################
|
||||||
INFO=0
|
INFO=0
|
||||||
@ -787,7 +790,6 @@ strip_quote() {
|
|||||||
|
|
||||||
#################### JSON FILE FORMATING ####################
|
#################### JSON FILE FORMATING ####################
|
||||||
fileout_pretty_json_header() {
|
fileout_pretty_json_header() {
|
||||||
START_TIME=$(date +%s)
|
|
||||||
target="$NODE"
|
target="$NODE"
|
||||||
$do_mx_all_ips && target="$URI"
|
$do_mx_all_ips && target="$URI"
|
||||||
|
|
||||||
@ -802,9 +804,8 @@ fileout_pretty_json_header() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fileout_pretty_json_footer() {
|
fileout_pretty_json_footer() {
|
||||||
local scan_time=$((END_TIME - START_TIME))
|
|
||||||
echo -e " ],
|
echo -e " ],
|
||||||
\"scanTime\" : \"$scan_time\"\n}"
|
\"scanTime\" : \"$SCAN_TIME\"\n}"
|
||||||
}
|
}
|
||||||
|
|
||||||
fileout_json_header() {
|
fileout_json_header() {
|
||||||
@ -10795,7 +10796,6 @@ maketempf() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
prepare_debug() {
|
prepare_debug() {
|
||||||
local hexc mac ossl_ciph ossl_supported_tls="" ossl_supported_sslv2=""
|
|
||||||
if [[ $DEBUG -ne 0 ]]; then
|
if [[ $DEBUG -ne 0 ]]; then
|
||||||
cat >$TEMPDIR/environment.txt << EOF
|
cat >$TEMPDIR/environment.txt << EOF
|
||||||
|
|
||||||
@ -10873,6 +10873,12 @@ EOF
|
|||||||
$OPENSSL ciphers -V 'ALL:COMPLEMENTOFALL' &>$TEMPDIR/all_local_ciphers.txt
|
$OPENSSL ciphers -V 'ALL:COMPLEMENTOFALL' &>$TEMPDIR/all_local_ciphers.txt
|
||||||
fi
|
fi
|
||||||
# see also $TEMPDIR/s_client_has.txt from find_openssl_binary
|
# see also $TEMPDIR/s_client_has.txt from find_openssl_binary
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
prepare_arrays() {
|
||||||
|
local hexc mac ossl_ciph
|
||||||
|
local ossl_supported_tls="" ossl_supported_sslv2=""
|
||||||
|
|
||||||
if [[ -e $CIPHERS_BY_STRENGTH_FILE ]]; then
|
if [[ -e $CIPHERS_BY_STRENGTH_FILE ]]; then
|
||||||
"$HAS_SSL2" && ossl_supported_sslv2="$($OPENSSL ciphers -ssl2 -V 'ALL:COMPLEMENTOFALL:@STRENGTH' 2>$ERRFILE)"
|
"$HAS_SSL2" && ossl_supported_sslv2="$($OPENSSL ciphers -ssl2 -V 'ALL:COMPLEMENTOFALL:@STRENGTH' 2>$ERRFILE)"
|
||||||
@ -12284,8 +12290,15 @@ reset_hostdepended_vars() {
|
|||||||
SERVER_SIZE_LIMIT_BUG=false
|
SERVER_SIZE_LIMIT_BUG=false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# rough estimate, in the future we maybe want to make use of nano secs (%N)
|
||||||
|
# note this is for performance debugging purposes (MEASURE_TIME=yes), so eye candy is not important
|
||||||
time_right_align() {
|
time_right_align() {
|
||||||
"$MEASURE_TIME" && printf "%${COLUMNS}s" "$START_TIME + $(($(date +%s) - START_TIME )) "
|
local new_delta
|
||||||
|
|
||||||
|
"$MEASURE_TIME" || return
|
||||||
|
new_delta=$(( $(date +%s) - LAST_TIME ))
|
||||||
|
printf "%${COLUMNS}s" "$new_delta"
|
||||||
|
LAST_TIME=$(( $new_delta + LAST_TIME ))
|
||||||
}
|
}
|
||||||
|
|
||||||
lets_roll() {
|
lets_roll() {
|
||||||
@ -12293,7 +12306,8 @@ lets_roll() {
|
|||||||
local section_number=1
|
local section_number=1
|
||||||
|
|
||||||
START_TIME=$(date +%s)
|
START_TIME=$(date +%s)
|
||||||
"$MEASURE_TIME" && printf "%${COLUMNS}s" "$START_TIME + $(($(date +%s) - START_TIME )) "
|
LAST_TIME=$START_TIME
|
||||||
|
time_right_align
|
||||||
|
|
||||||
[[ -z "$NODEIP" ]] && fatal "$NODE doesn't resolve to an IP address" 2
|
[[ -z "$NODEIP" ]] && fatal "$NODE doesn't resolve to an IP address" 2
|
||||||
nodeip_to_proper_ip6
|
nodeip_to_proper_ip6
|
||||||
@ -12378,8 +12392,11 @@ lets_roll() {
|
|||||||
|
|
||||||
outln
|
outln
|
||||||
END_TIME=$(date +%s)
|
END_TIME=$(date +%s)
|
||||||
|
SCAN_TIME=$((END_TIME - START_TIME))
|
||||||
datebanner " Done"
|
datebanner " Done"
|
||||||
|
|
||||||
|
"$MEASURE_TIME" && printf "%${COLUMNS}s\n" "$SCAN_TIME"
|
||||||
|
|
||||||
return $ret
|
return $ret
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12396,6 +12413,7 @@ set_color_functions
|
|||||||
maketempf
|
maketempf
|
||||||
find_openssl_binary
|
find_openssl_binary
|
||||||
prepare_debug
|
prepare_debug
|
||||||
|
prepare_arrays
|
||||||
mybanner
|
mybanner
|
||||||
check_proxy
|
check_proxy
|
||||||
check4openssl_oldfarts
|
check4openssl_oldfarts
|
||||||
|
Loading…
Reference in New Issue
Block a user