2
0
mirror of https://github.com/mozilla/cipherscan.git synced 2024-11-16 11:53:43 +01:00

Merge pull request #95 from tomato42/auto-colour

autodetect if the colors should be used
This commit is contained in:
Julien Vehent 2015-09-19 11:05:16 -04:00
commit 67c2a7cfe4

View File

@ -197,7 +197,7 @@ DELAY=0
ALLCIPHERS="" ALLCIPHERS=""
OUTPUTFORMAT="terminal" OUTPUTFORMAT="terminal"
TIMEOUT=30 TIMEOUT=30
USECOLORS="True" USECOLORS="auto"
# place where to put the found intermediate CA certificates and where # place where to put the found intermediate CA certificates and where
# trust anchors are stored # trust anchors are stored
SAVECRT="" SAVECRT=""
@ -250,6 +250,7 @@ Use one of the options below:
--[no-]curves test ECC curves supported by server (req. OpenSSL 1.0.2) --[no-]curves test ECC curves supported by server (req. OpenSSL 1.0.2)
--[no-]tolerance test TLS tolerance --[no-]tolerance test TLS tolerance
--no-sni don't use Server Name Indication --no-sni don't use Server Name Indication
--colors force use of colors (autodetect by default)
--no-colors don't use terminal colors --no-colors don't use terminal colors
-v | --verbose Increase verbosity. -v | --verbose Increase verbosity.
@ -690,7 +691,14 @@ display_results_in_terminal() {
local curvesordering local curvesordering
local different=False local different=False
# Configure colors, if terminal supports them # Configure colors, if terminal supports them
if [[ $USECOLORS == "True" && -x /usr/bin/tput ]] && tput setaf 1 >&/dev/null; then if [[ $USECOLORS == "auto" ]]; then
if [[ -t 1 ]]; then
USECOLORS="True"
else
USECOLORS="False"
fi
fi
if [[ $USECOLORS == "True" ]]; then
c_blue="\033[0;34m" c_blue="\033[0;34m"
c_green="\033[0;32m" c_green="\033[0;32m"
c_red="\033[0;31m" c_red="\033[0;31m"
@ -1422,6 +1430,10 @@ do
TEST_TOLERANCE="False" TEST_TOLERANCE="False"
shift 1 shift 1
;; ;;
--colors)
USECOLORS="True"
shift 1
;;
--no-colors) --no-colors)
USECOLORS="False" USECOLORS="False"
shift 1 shift 1