diff --git a/cipherscan b/cipherscan index 6efb49c..e11fc77 100755 --- a/cipherscan +++ b/cipherscan @@ -251,6 +251,10 @@ test_cipher_on_target() { ratelimit debug echo \"Q\" \| $cmnd $tls_version local tmp=$(echo "Q" | $cmnd $tls_version 1>/dev/stdout 2>/dev/null) + if ! [ -z "$tmp" ] ; then + verbose "response received from server" + couldconnect=true + fi parse_openssl_output <<<"$tmp" verbose "selected cipher is '$current_cipher'" @@ -403,7 +407,6 @@ bench_cipher() { # Connect to the target and retrieve the chosen cipher # recursively until the connection fails get_cipher_pref() { - [ "$OUTPUTFORMAT" == "terminal" ] && [ $DEBUG -lt 1 ] && echo -n '.' local ciphersuite="$1" local sslcommand="$TIMEOUTBIN $TIMEOUT $OPENSSLBIN s_client" @@ -419,6 +422,7 @@ get_cipher_pref() { local success=$? # If the connection succeeded with the current cipher, benchmark and store if [ $success -eq 0 ]; then + [ "$OUTPUTFORMAT" == "terminal" ] && [ $DEBUG -lt 1 ] && echo -n '.' cipherspref=("${cipherspref[@]}" "$result") ciphercertificates=("${ciphercertificates[@]}" "$certificates") pciph=($result) @@ -698,9 +702,14 @@ debug "sclientargs: $SCLIENTARGS" cipherspref=(); ciphercertificates=() results=() +couldconnect=false # Call to the recursive loop that retrieves the cipher preferences get_cipher_pref $CIPHERSUITE +if ! $couldconnect; then + echo "Could not connect to $TARGET" + exit 1 +fi test_serverside_ordering