mirror of
https://github.com/mozilla/cipherscan.git
synced 2024-11-26 07:53:41 +01:00
Replace instances of string-ish [[ -gt ]] with arithmetic (( > )).
This commit is contained in:
parent
9c63841e46
commit
3d3789828b
10
cipherscan
10
cipherscan
@ -442,7 +442,7 @@ parse_openssl_output() {
|
|||||||
|
|
||||||
# if we found any certs in output, process the first one and extract
|
# if we found any certs in output, process the first one and extract
|
||||||
# the signature algorithm on it (it's the server's certificate)
|
# the signature algorithm on it (it's the server's certificate)
|
||||||
if [[ $certs_found -gt 0 ]]; then
|
if (( certs_found > 0 )); then
|
||||||
local ossl_out=$(${OPENSSLBIN} x509 -noout -text 2>/dev/null <<<"${current_raw_certificates[0]}")
|
local ossl_out=$(${OPENSSLBIN} x509 -noout -text 2>/dev/null <<<"${current_raw_certificates[0]}")
|
||||||
local regex='Signature Algorithm[^ ]+ +(.+$)'
|
local regex='Signature Algorithm[^ ]+ +(.+$)'
|
||||||
while read data; do
|
while read data; do
|
||||||
@ -795,7 +795,7 @@ display_results_in_json() {
|
|||||||
echo -n "{\"target\":\"$TARGET\",\"utctimestamp\":\"$(date -u '+%FT%T.0Z')\",\"serverside\":\"${serverside}\",\"ciphersuite\": ["
|
echo -n "{\"target\":\"$TARGET\",\"utctimestamp\":\"$(date -u '+%FT%T.0Z')\",\"serverside\":\"${serverside}\",\"ciphersuite\": ["
|
||||||
for cipher in "${cipherspref[@]}"; do
|
for cipher in "${cipherspref[@]}"; do
|
||||||
local cipher_arr=($cipher)
|
local cipher_arr=($cipher)
|
||||||
[[ $ctr -gt 0 ]] && echo -n ','
|
(( ctr > 0 )) && echo -n ','
|
||||||
echo -n "{\"cipher\":\"${cipher_arr[0]}\","
|
echo -n "{\"cipher\":\"${cipher_arr[0]}\","
|
||||||
echo -n "\"protocols\":[\"${cipher_arr[1]//,/\",\"}\"],"
|
echo -n "\"protocols\":[\"${cipher_arr[1]//,/\",\"}\"],"
|
||||||
echo -n "\"pubkey\":[\"${cipher_arr[2]//,/\",\"}\"],"
|
echo -n "\"pubkey\":[\"${cipher_arr[2]//,/\",\"}\"],"
|
||||||
@ -828,7 +828,7 @@ display_results_in_json() {
|
|||||||
ctr=0
|
ctr=0
|
||||||
for test_name in "${!tls_tolerance[@]}"; do
|
for test_name in "${!tls_tolerance[@]}"; do
|
||||||
local result=(${tls_tolerance[$test_name]})
|
local result=(${tls_tolerance[$test_name]})
|
||||||
[[ $ctr -gt 0 ]] && echo -n ","
|
(( ctr > 0 )) && echo -n ","
|
||||||
echo -n "\"$test_name\":{"
|
echo -n "\"$test_name\":{"
|
||||||
if [[ ${result[0]} == "False" ]]; then
|
if [[ ${result[0]} == "False" ]]; then
|
||||||
echo -n "\"tolerant\":\"False\""
|
echo -n "\"tolerant\":\"False\""
|
||||||
@ -926,7 +926,7 @@ test_curves() {
|
|||||||
# either get a fallback to a non ECC cipher, we run of curves or server
|
# either get a fallback to a non ECC cipher, we run of curves or server
|
||||||
# tries to negotiate a curve we didn't advertise
|
# tries to negotiate a curve we didn't advertise
|
||||||
#
|
#
|
||||||
while [[ ${#curves[@]} -gt 0 ]]; do
|
while (( ${#curves[@]} > 0 )); do
|
||||||
join_array_by_char ':' "${curves[@]}"
|
join_array_by_char ':' "${curves[@]}"
|
||||||
local test_curves="$joined_array"
|
local test_curves="$joined_array"
|
||||||
verbose "Testing $test_curves with command $sslcommand"
|
verbose "Testing $test_curves with command $sslcommand"
|
||||||
@ -1046,7 +1046,7 @@ test_curves_fallback() {
|
|||||||
# tries to negotiate a curve we didn't advertise
|
# tries to negotiate a curve we didn't advertise
|
||||||
#
|
#
|
||||||
local curves=(${CURVES[*]})
|
local curves=(${CURVES[*]})
|
||||||
while [[ ${#curves[@]} -gt 0 ]]; do
|
while (( ${#curves[@]} > 0 )); do
|
||||||
join_array_by_char ':' "${curves[@]}"
|
join_array_by_char ':' "${curves[@]}"
|
||||||
local test_curves="$joined_array"
|
local test_curves="$joined_array"
|
||||||
verbose "Testing $sslcommand -curves $test_curves"
|
verbose "Testing $sslcommand -curves $test_curves"
|
||||||
|
Loading…
Reference in New Issue
Block a user