mirror of
https://github.com/drwetter/testssl.sh.git
synced 2025-01-03 23:39:45 +01:00
New socksend(), json flat: scan time
There's a new socksend() function which gives up to 8% performance benefit (LAN) as is saves 3 sed and 1 tr command in every socksend call. It has not been put in production yet as it shows a problem in ticketbleed check and it is late and I call it a day ;-) and resolve that later (see #902). For performance tests it's quite handy to also have in the flat json format a footer with time consumed for each run. fileout_json_footer() was patched accordingly.
This commit is contained in:
parent
9949be750d
commit
cce48a34d0
32
testssl.sh
32
testssl.sh
@ -639,14 +639,13 @@ strip_quote() {
|
||||
|
||||
#################### JSON FILE FORMATING ####################
|
||||
|
||||
fileout_pretty_json_footer() {
|
||||
echo -e " ],
|
||||
\"scanTime\" : \"$SCAN_TIME\"\n}"
|
||||
}
|
||||
|
||||
fileout_json_footer() {
|
||||
"$do_json" && printf "]\n" >> "$JSONFILE"
|
||||
"$do_pretty_json" && (printf "$(fileout_pretty_json_footer)") >> "$JSONFILE"
|
||||
if "$do_json"; then
|
||||
fileout_json_finding "scanTime" "INFO" "$SCAN_TIME" "" "" ""
|
||||
printf "]\n" >> "$JSONFILE"
|
||||
fi
|
||||
"$do_pretty_json" && echo -e " ],
|
||||
\"scanTime\" : \"$SCAN_TIME\"\n}" >> "$JSONFILE"
|
||||
}
|
||||
|
||||
fileout_json_section() {
|
||||
@ -695,6 +694,7 @@ fileout_json_print_parameter() {
|
||||
|
||||
fileout_json_finding() {
|
||||
local target
|
||||
local finding="$3" # FIXME: dealing with locals and globals in fileout()
|
||||
|
||||
if "$do_json"; then
|
||||
"$FIRST_FINDING" || echo -n "," >> "$JSONFILE"
|
||||
@ -2598,6 +2598,8 @@ std_cipherlists() {
|
||||
# ARG1: hexbyte with a leading comma (!!), separated by commas
|
||||
# ARG2: sleep
|
||||
socksend() {
|
||||
local data
|
||||
|
||||
# the following works under BSD and Linux, which is quite tricky. So don't mess with it unless you're really sure what you do
|
||||
if "$HAS_SED_E"; then
|
||||
data=$(sed -e 's/# .*$//g' -e 's/ //g' <<< "$1" | sed -E 's/^[[:space:]]+//; s/[[:space:]]+$//; /^$/d' | sed 's/,/\\/g' | tr -d '\n')
|
||||
@ -2609,6 +2611,20 @@ socksend() {
|
||||
sleep $2
|
||||
}
|
||||
|
||||
socksend2() {
|
||||
local data line
|
||||
|
||||
# read line per line and strip comments (bash internal func can't handle multiline statements
|
||||
data="$(while read line; do
|
||||
printf "${line%\#*}"
|
||||
done <<< "$1" )"
|
||||
data="${data// /}" # strip ' '
|
||||
data="${data//,/\\}" # s&r , by \
|
||||
[[ $DEBUG -ge 4 ]] && echo && echo "\"$data\""
|
||||
printf -- "$data" >&5 2>/dev/null &
|
||||
sleep $2
|
||||
}
|
||||
|
||||
|
||||
openssl2rfc() {
|
||||
local rfcname=""
|
||||
@ -12322,7 +12338,7 @@ run_grease() {
|
||||
fi
|
||||
|
||||
# Check for ClientHello size bug. According to RFC 7586 "at least one TLS
|
||||
# implementation is known to hang the connection when [a] ClientHello
|
||||
# implementation is known to hang the connection when [a] ClientHello
|
||||
# record [with a length between 256 and 511 bytes] is received."
|
||||
# If the length of the host name is more than 75 bytes (which would make
|
||||
# $SNI more than 87 bytes), then the ClientHello would be more than 511
|
||||
|
Loading…
Reference in New Issue
Block a user