mirror of
				https://github.com/drwetter/testssl.sh.git
				synced 2025-11-04 07:45:27 +01:00 
			
		
		
		
	Merge pull request #797 from dcooper16/yaSSL_client_simulation
yaSSL and client simulation
This commit is contained in:
		
							
								
								
									
										18
									
								
								testssl.sh
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								testssl.sh
									
									
									
									
									
								
							@@ -3436,6 +3436,7 @@ client_simulation_sockets() {
 | 
			
		||||
     local cipher_list_2send
 | 
			
		||||
     local sock_reply_file2 sock_reply_file3
 | 
			
		||||
     local tls_hello_ascii next_packet hello_done=0
 | 
			
		||||
     local -i sid_len offset1 offset2
 | 
			
		||||
 | 
			
		||||
     if [[ "${1:0:4}" == "1603" ]]; then
 | 
			
		||||
          clienthello="$(create_client_simulation_tls_clienthello "$1")"
 | 
			
		||||
@@ -3446,6 +3447,21 @@ client_simulation_sockets() {
 | 
			
		||||
     for (( i=0; i < len; i=i+2 )); do
 | 
			
		||||
          data+=", ${clienthello:i:2}"
 | 
			
		||||
     done
 | 
			
		||||
     if [[ "${1:0:4}" == "1603" ]]; then
 | 
			
		||||
          # Extact list of cipher suites from SSLv3 or later ClientHello
 | 
			
		||||
          sid_len=4*$(hex2dec "${data:174:2}")
 | 
			
		||||
          offset1=178+$sid_len
 | 
			
		||||
          offset2=182+$sid_len
 | 
			
		||||
          len=4*$(hex2dec "${data:offset1:2}${data:offset2:2}")-2
 | 
			
		||||
          offset1=186+$sid_len
 | 
			
		||||
     else
 | 
			
		||||
          # Extact list of cipher suites from SSLv2 ClientHello
 | 
			
		||||
          offset1=46
 | 
			
		||||
          len=4*$(hex2dec "${data:26:2}")-2
 | 
			
		||||
     fi
 | 
			
		||||
     code2network "$(tolower "${data:offset1:len}")"   # convert CIPHER_SUITES to a "standardized" format
 | 
			
		||||
     cipher_list_2send="$NW_STR"
 | 
			
		||||
 | 
			
		||||
     debugme echo "sending client hello..."
 | 
			
		||||
     code2network "${data}"
 | 
			
		||||
     data="$NW_STR"
 | 
			
		||||
@@ -3497,7 +3513,7 @@ client_simulation_sockets() {
 | 
			
		||||
          echo
 | 
			
		||||
     fi
 | 
			
		||||
 | 
			
		||||
     parse_tls_serverhello "$tls_hello_ascii" "ephemeralkey"
 | 
			
		||||
     parse_tls_serverhello "$tls_hello_ascii" "ephemeralkey" "$cipher_list_2send"
 | 
			
		||||
     save=$?
 | 
			
		||||
 | 
			
		||||
     if [[ $save -eq 0 ]]; then
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user