mirror of
				https://github.com/drwetter/testssl.sh.git
				synced 2025-10-30 21:35:26 +01:00 
			
		
		
		
	Merge branch '2.9dev' into unsupported_ciphers_in_litegrey
This commit is contained in:
		
							
								
								
									
										57
									
								
								testssl.sh
									
									
									
									
									
								
							
							
						
						
									
										57
									
								
								testssl.sh
									
									
									
									
									
								
							| @@ -270,6 +270,8 @@ HEX_CIPHER="" | ||||
| HEXDUMP=(hexdump -ve '16/1 "%02x " " \n"')   # This is used to analyze the reply | ||||
| HEXDUMPPLAIN=(hexdump -ve '1/1 "%.2x"')      # Replaces both xxd -p and tr -cd '[:print:]' | ||||
|  | ||||
| SERVER_COUNTER=0                             # Counter for multiple servers | ||||
|  | ||||
| #################### SEVERITY #################### | ||||
| INFO=0 | ||||
| OK=0 | ||||
| @@ -704,65 +706,62 @@ strip_quote() { | ||||
| #################### JSON FILE FORMATING #################### | ||||
| fileout_pretty_json_header() { | ||||
|     START_TIME=$(date +%s) | ||||
|     target="$NODE" | ||||
|     $do_mx_all_ips && target="$URI" | ||||
|  | ||||
|     echo -e "          \"Invocation\"  : \"$PROG_NAME $CMDLINE\", | ||||
|           \"at\"          : \"$HNAME:$OPENSSL_LOCATION\", | ||||
|           \"version\"     : \"$VERSION ${GIT_REL_SHORT:-$CVS_REL_SHORT} from $REL_DATE\", | ||||
|           \"openssl\"     : \"$OSSL_VER from $OSSL_BUILD_DATE\", | ||||
|           \"target host\" : \"$NODE\", | ||||
|           \"target host\" : \"$target\", | ||||
|           \"port\"        : \"$PORT\", | ||||
|           \"startTime\"   : \"$START_TIME\", | ||||
|           \"scanResult\"  : { | ||||
|           " | ||||
|           \"scanResult\"  : [" | ||||
| } | ||||
|  | ||||
| fileout_pretty_json_footer() { | ||||
|     local scan_time=$((END_TIME - START_TIME)) | ||||
|     echo -e "          }, | ||||
|           \"ip\"        : \"$NODEIP\", | ||||
|     echo -e "          ], | ||||
|           \"scanTime\"  : \"$scan_time\"\n}" | ||||
| } | ||||
|  | ||||
| fileout_json_header() { | ||||
|      "$do_json" && printf "[\n" > "$JSONFILE" | ||||
|      "$do_pretty_json" && (printf "{\n%s" "$(fileout_pretty_json_header)") > "$JSONFILE" | ||||
|      "$do_pretty_json" && (printf "{\n%s\n" "$(fileout_pretty_json_header)") > "$JSONFILE" | ||||
| } | ||||
|  | ||||
| fileout_json_footer() { | ||||
|      "$do_json" && printf "]\n" >> "$JSONFILE" | ||||
|      "$do_pretty_json" && (printf "\n%s" "$(fileout_pretty_json_footer)") >> "$JSONFILE" | ||||
|      "$do_pretty_json" && (printf "$(fileout_pretty_json_footer)") >> "$JSONFILE" | ||||
| } | ||||
|  | ||||
| fileout_json_section() { | ||||
|     case $1 in | ||||
|     1) | ||||
|         echo -e "          \"service\"           : [" | ||||
|         echo -e    "                    \"protocols\"         : [" | ||||
|         ;; | ||||
|     2) | ||||
|         echo -e ",\n                    \"protocols\"         : [" | ||||
|         ;; | ||||
|     3) | ||||
|         echo -e ",\n                    \"ciphers\"           : [" | ||||
|         ;; | ||||
|     4) | ||||
|     3) | ||||
|         echo -e ",\n                    \"pfs\"               : [" | ||||
|         ;; | ||||
|     5) | ||||
|     4) | ||||
|         echo -e ",\n                    \"serverPreferences\" : [" | ||||
|         ;; | ||||
|     6) | ||||
|     5) | ||||
|         echo -e ",\n                    \"serverDefaults\"    : [" | ||||
|         ;; | ||||
|     7) | ||||
|     6) | ||||
|         echo -e ",\n                    \"headerResponse\"    : [" | ||||
|         ;; | ||||
|     8) | ||||
|     7) | ||||
|         echo -e ",\n                    \"vulnerabilities\"   : [" | ||||
|         ;; | ||||
|     9) | ||||
|     8) | ||||
|         echo -e ",\n                    \"cipherTests\"       : [" | ||||
|         ;; | ||||
|     10) | ||||
|     9) | ||||
|         echo -e ",\n                    \"browserSimulations\": [" | ||||
|         ;; | ||||
|     *) | ||||
| @@ -773,12 +772,13 @@ fileout_json_section() { | ||||
|  | ||||
| fileout_section_header(){ | ||||
|     local str="" | ||||
|     $2 && str="$(fileout_section_footer)" | ||||
|     $2 && str="$(fileout_section_footer false)" | ||||
|     "$do_pretty_json" && FIRST_FINDING=true && (printf "%s%s\n" "$str" "$(fileout_json_section "$1")") >> "$JSONFILE" | ||||
| } | ||||
|  | ||||
| fileout_section_footer() { | ||||
| fileout_section_footer() { # IS_THE_LAST_ONE | ||||
|     "$do_pretty_json" && printf "\n                    ]" >> "$JSONFILE" | ||||
|     "$do_pretty_json" && $1 && echo -e "\n          }" >> "$JSONFILE" | ||||
| } | ||||
|  | ||||
| fileout_json_print_parameter() { | ||||
| @@ -816,6 +816,15 @@ fileout_json_finding() { | ||||
|          echo -e "\n         }" >> "$JSONFILE" | ||||
|     fi | ||||
|     if "$do_pretty_json"; then | ||||
|         if [[ "$1" == "service" ]]; then | ||||
|             if [[ $SERVER_COUNTER -gt 1 ]]; then | ||||
|                 echo "          ," >> "$JSONFILE" | ||||
|             fi | ||||
|             echo -e "          { | ||||
|                     \"service\"         : \"$finding\", | ||||
|                     \"ip\"              : \"$NODEIP\","  >> "$JSONFILE" | ||||
|             $do_mx_all_ips && echo -e "                    \"hostname\"        : \"$NODE\","  >> "$JSONFILE" | ||||
|         else | ||||
|             ("$FIRST_FINDING" && echo -n "                            {" >> "$JSONFILE") || echo -n ",{" >> "$JSONFILE" | ||||
|             echo -e -n "\n"  >> "$JSONFILE" | ||||
|             fileout_json_print_parameter "id" "           " "$1" true | ||||
| @@ -826,6 +835,7 @@ fileout_json_finding() { | ||||
|             fileout_json_print_parameter "finding" "      " "$finding" false | ||||
|             echo -e -n "\n                           }" >> "$JSONFILE" | ||||
|         fi | ||||
|     fi | ||||
| } | ||||
|  | ||||
| is_json_format() { | ||||
| @@ -11697,6 +11707,7 @@ determine_service() { | ||||
|                     fi | ||||
|                     grep -q '^Server Temp Key' $TMPFILE && HAS_DH_BITS=true     # FIX #190 | ||||
|                     out " Service set:$CORRECT_SPACES            STARTTLS via " | ||||
|                     fileout "service" "INFO" "$protocol" | ||||
|                     toupper "$protocol" | ||||
|                     [[ -n "$XMPP_HOST" ]] && echo -n " (XMPP domain=\'$XMPP_HOST\')" | ||||
|                     outln | ||||
| @@ -12336,7 +12347,7 @@ lets_roll() { | ||||
|  | ||||
|      START_TIME=$(date +%s) | ||||
|  | ||||
|      fileout_section_header $section_number false && ((section_number++)) | ||||
|      ((SERVER_COUNTER++)) | ||||
|      determine_service "$1"        # any starttls service goes here | ||||
|  | ||||
|      $do_tls_sockets && [[ $TLS_LOW_BYTE -eq 22 ]] && { sslv2_sockets "" "true"; echo "$?" ; exit 0; } | ||||
| @@ -12344,7 +12355,7 @@ lets_roll() { | ||||
|      $do_test_just_one && test_just_one ${single_cipher} | ||||
|  | ||||
|      # all top level functions  now following have the prefix "run_" | ||||
|      fileout_section_header $section_number true && ((section_number++)) | ||||
|      fileout_section_header $section_number false && ((section_number++)) | ||||
|      $do_protocols && { run_protocols; ret=$(($? + ret)); } | ||||
|      $do_spdy && { run_spdy; ret=$(($? + ret)); } | ||||
|      $do_http2 && { run_http2; ret=$(($? + ret)); } | ||||
| @@ -12406,7 +12417,7 @@ lets_roll() { | ||||
|      fileout_section_header $section_number true && ((section_number++)) | ||||
|      $do_client_simulation && { run_client_simulation; ret=$(($? + ret)); } | ||||
|  | ||||
|      fileout_section_footer | ||||
|      fileout_section_footer true | ||||
|  | ||||
|      outln | ||||
|      END_TIME=$(date +%s) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 David Cooper
					David Cooper