From fb98c2bf7f8015c5293e6881a7bf87b5fa2b1dfd Mon Sep 17 00:00:00 2001 From: Cristina Munoz Date: Tue, 5 Dec 2017 15:21:37 -0500 Subject: [PATCH] add support for result diffing --- testssl.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/testssl.sh b/testssl.sh index c9dee61..1440d1f 100755 --- a/testssl.sh +++ b/testssl.sh @@ -193,6 +193,8 @@ CSVFILE="${CSVFILE:-""}" # csvfile if used HTMLFILE="${HTMLFILE:-""}" # HTML if used FNAME=${FNAME:-""} # file name to read commands from FNAME_PREFIX=${FNAME_PREFIX:-""} # output filename prefix, see --outprefix +FNAME_RESULT1=${FNAME_RESULT1:-""} # filename of a result file used to compute diff, see --diff +FNAME_RESULT2=${FNAME_RESULT2:-""} # filename of second result file used to compute diff, see --diff APPEND=${APPEND:-false} # append to csv/json file instead of overwriting it NODNS=${NODNS:-false} # always do DNS lookups per default. For some pentests it might save time to set this to true HAS_IPv6=${HAS_IPv6:-false} # if you have OpenSSL with IPv6 support AND IPv6 networking set it to yes @@ -13152,8 +13154,8 @@ help() { -v, --version same as previous -V, --local pretty print all local ciphers -V, --local which local ciphers with are available? If pattern is not a number: word match - is always an ignore case word pattern of cipher hexcode or any other string in the name, kx or bits + -d, --diff computes and outputs the diff between the supplied result files "$PROG_NAME ", where is: @@ -13437,6 +13439,9 @@ EOF outln " (built: \"$OSSL_BUILD_DATE\", platform: \"$OSSL_VER_PLATFORM\")\n" } +compute_diff () { + diff --unified $FNAME_RESULT1 $FNAME_RESULT2 +} cleanup () { # If parallel mass testing is being performed, then the child tests need @@ -14862,6 +14867,13 @@ parse_cmd_line() { mybanner exit 0 ;; + -d|--diff|--diff=*) + IFS=',' read -ra NAMES <<< "$(parse_opt_equal_sign "$1" "$2")" + FNAME_RESULT1=${NAMES[0]} + FNAME_RESULT2=${NAMES[1]} + compute_diff + exit 0 + ;; --mx) do_mx_all_ips=true PORT=25