mirror of
https://github.com/drwetter/testssl.sh.git
synced 2024-12-31 22:09:44 +01:00
grep -o to the rescue
The original sed command does not work on FreeBSD I wanted an all in one extraction sed command, but didn't find it, so this line extracts all the hexadecimal representations and the tls_version placeholder and adds the slash before removing the new line characters
This commit is contained in:
parent
7289d49f6c
commit
4ad8ae7659
18
testssl.sh
18
testssl.sh
@ -1006,11 +1006,11 @@ ccs_injection(){
|
||||
|
||||
client_hello="
|
||||
# TLS header ( 5 bytes)
|
||||
,x16, # Content type (x16 for handshake)
|
||||
,x16, # Content type (0x16 for handshake)
|
||||
x03, tls_version, # TLS Version
|
||||
x00, x93, # Length
|
||||
# Handshake header
|
||||
x01, # Type (x01 for ClientHello)
|
||||
x01, # Type (0x01 for ClientHello)
|
||||
x00, x00, x8f, # Length
|
||||
x03, tls_version, # TLS Version
|
||||
# Random (32 byte)
|
||||
@ -1035,8 +1035,9 @@ ccs_injection(){
|
||||
x00, x07, x00, x06, x00, x05, x00, x04,
|
||||
x00, x03, x00, x02, x00, x01, x01, x00"
|
||||
|
||||
msg=`echo "$client_hello" | sed -e 's/# .*$//g' -e 's/,/\\\/g' | sed -e 's/ //g' -e 's/[ \t]//g' | tr -d '\n'`
|
||||
|
||||
msg=`echo "$client_hello" | grep -o '\bx[[:xdigit:]]\{2\}\b\|tls_version' | sed -e 's/x/\\\x/g' -e 's/tls_version/\\\tls_version/g' | tr -d '\n'`
|
||||
#msg=`echo "$client_hello" | sed -e 's/# .*$//g' -e 's/,/\\\/g' | sed -e 's/ //g' -e 's/[ \t]//g' | tr -d '\n'`
|
||||
|
||||
fd_socket 5 || return 6
|
||||
|
||||
[ $VERBOSE -eq 1 ] && out " sending client hello, "
|
||||
@ -1104,11 +1105,11 @@ heartbleed(){
|
||||
|
||||
client_hello="
|
||||
# TLS header ( 5 bytes)
|
||||
,x16, # Content type (x16 for handshake)
|
||||
,x16, # Content type (0x16 for handshake)
|
||||
x03, tls_version, # TLS Version
|
||||
x00, xdc, # Length
|
||||
# Handshake header
|
||||
x01, # Type (x01 for ClientHello)
|
||||
x01, # Type (0x01 for ClientHello)
|
||||
x00, x00, xd8, # Length
|
||||
x03, tls_version, # TLS Version
|
||||
# Random (32 byte)
|
||||
@ -1133,7 +1134,7 @@ heartbleed(){
|
||||
x00, x09, x00, x14, x00, x11, x00, x08,
|
||||
x00, x06, x00, x03, x00, xff,
|
||||
x01, # Compression methods length
|
||||
x00, # Compression method (x00 for NULL)
|
||||
x00, # Compression method (0x00 for NULL)
|
||||
x00, x49, # Extensions length
|
||||
# Extension: ec_point_formats
|
||||
x00, x0b, x00, x04, x03, x00, x01, x02,
|
||||
@ -1150,7 +1151,8 @@ heartbleed(){
|
||||
# Extension: Heartbeat
|
||||
x00, x0f, x00, x01, x01"
|
||||
|
||||
msg=`echo "$client_hello" | sed -e 's/# .*$//g' -e 's/,/\\\/g' | sed -e 's/ //g' -e 's/[ \t]//g' | tr -d '\n'`
|
||||
msg=`echo "$client_hello" | grep -o '\bx[[:xdigit:]]\{2\}\b\|tls_version' | sed -e 's/x/\\\x/g' -e 's/tls_version/\\\tls_version/g' | tr -d '\n'`
|
||||
#msg=`echo "$client_hello" | sed -e 's/# .*$//g' -e 's/,/\\\/g' | sed -e 's/ //g' -e 's/[ \t]//g' | tr -d '\n'`
|
||||
|
||||
fd_socket 5 || return 6
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user