mirror of
				https://github.com/drwetter/testssl.sh.git
				synced 2025-11-04 07:45:27 +01:00 
			
		
		
		
	Merge pull request #632 from dcooper16/negotiated_cipher
Negotiated cipher per proto bugfix
This commit is contained in:
		
							
								
								
									
										20
									
								
								testssl.sh
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								testssl.sh
									
									
									
									
									
								
							@@ -4835,7 +4835,7 @@ read_dhbits_from_file() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
run_server_preference() {
 | 
					run_server_preference() {
 | 
				
			||||||
     local cipher1 cipher2
 | 
					     local cipher1 cipher2 prev_cipher=""
 | 
				
			||||||
     local default_cipher default_cipher_ossl default_proto
 | 
					     local default_cipher default_cipher_ossl default_proto
 | 
				
			||||||
     local remark4default_cipher supported_sslv2_ciphers
 | 
					     local remark4default_cipher supported_sslv2_ciphers
 | 
				
			||||||
     local -a cipher proto
 | 
					     local -a cipher proto
 | 
				
			||||||
@@ -5101,25 +5101,17 @@ run_server_preference() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
               for i in 1 2 3 4 5 6; do
 | 
					               for i in 1 2 3 4 5 6; do
 | 
				
			||||||
                    if [[ -n "${cipher[i]}" ]]; then                                      # cipher not empty
 | 
					                    if [[ -n "${cipher[i]}" ]]; then                                      # cipher not empty
 | 
				
			||||||
                          if [[ -z "${cipher[i-1]}" ]]; then                              # previous one empty
 | 
					                          if [[ -z "$prev_cipher" ]] || [[ "$prev_cipher" != "${cipher[i]}" ]]; then
 | 
				
			||||||
                              #outln
 | 
					                              [[ -n "$prev_cipher" ]] && outln
 | 
				
			||||||
                              if [[ "$DISPLAY_CIPHERNAMES" =~ openssl ]]; then
 | 
					                              if [[ "$DISPLAY_CIPHERNAMES" =~ openssl ]]; then
 | 
				
			||||||
                                   printf -- "     %-30s %s" "${cipher[i]}:" "${proto[i]}"     # print out both
 | 
					                                   printf -- "     %-30s %s" "${cipher[i]}:" "${proto[i]}"     # print out both
 | 
				
			||||||
                              else
 | 
					                              else
 | 
				
			||||||
                                   printf -- "     %-51s %s" "${cipher[i]}:" "${proto[i]}"     # print out both
 | 
					                                   printf -- "     %-51s %s" "${cipher[i]}:" "${proto[i]}"     # print out both
 | 
				
			||||||
                              fi
 | 
					                              fi
 | 
				
			||||||
                          else                                                            # previous NOT empty
 | 
					                          else
 | 
				
			||||||
                              if [[ "${cipher[i-1]}" == "${cipher[i]}" ]]; then           # and previous protocol same cipher
 | 
					                              out ", ${proto[i]}"           # same cipher --> only print out protocol behind it
 | 
				
			||||||
                                   out ", ${proto[i]}"                                    # same cipher --> only print out protocol behind it
 | 
					 | 
				
			||||||
                              else
 | 
					 | 
				
			||||||
                                   outln
 | 
					 | 
				
			||||||
                                   if [[ "$DISPLAY_CIPHERNAMES" =~ openssl ]]; then
 | 
					 | 
				
			||||||
                                        printf -- "     %-30s %s" "${cipher[i]}:" "${proto[i]}"     # print out both
 | 
					 | 
				
			||||||
                                   else
 | 
					 | 
				
			||||||
                                        printf -- "     %-51s %s" "${cipher[i]}:" "${proto[i]}"     # print out both
 | 
					 | 
				
			||||||
                                   fi
 | 
					 | 
				
			||||||
                             fi
 | 
					 | 
				
			||||||
                          fi
 | 
					                          fi
 | 
				
			||||||
 | 
					                          prev_cipher="${cipher[i]}"
 | 
				
			||||||
                    fi
 | 
					                    fi
 | 
				
			||||||
                    fileout "order_${proto[i]}_cipher" "INFO" "Default cipher on ${proto[i]}: ${cipher[i]} $remark4default_cipher"
 | 
					                    fileout "order_${proto[i]}_cipher" "INFO" "Default cipher on ${proto[i]}: ${cipher[i]} $remark4default_cipher"
 | 
				
			||||||
               done
 | 
					               done
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user