From 7289d49f6c3b7df1d8c5f621faa8edc4a3007c70 Mon Sep 17 00:00:00 2001 From: Olivier Paroz Date: Wed, 24 Sep 2014 13:08:24 +0200 Subject: [PATCH] Introducing 3 hexdump commands `hexdump -C` is used in verbose mode to see what is going on. Unfortunately, it's not possible to get more than 16 columns `hexdump -ve '16/1 "%02x " " \n"'` is used to analyse the reply given by the server. There is no offset and no human readable character output `hexdump -ve '1/1 "%.2x"'` is used to generate a pure hexadecimal stream of data --- testssl.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/testssl.sh b/testssl.sh index 0cbf2df..ba4014b 100755 --- a/testssl.sh +++ b/testssl.sh @@ -81,8 +81,9 @@ IPS="" MAX_WAITSOCK=10 # waiting at max 10 seconds for socket reply # The various hexdump commands we need to replace xdd -HEXDUMP=(hexdump -ve '"%07_ax " 16/2 "%06o " " \n"') -HEXDUMPPLAIN=(hexdump -ve '30/1 "%.2x" "\n"') +HEXDUMPVIEW=(hexdump -C) # This is used in verbose mode to see what's going on +HEXDUMP=(hexdump -ve '16/1 "%02x " " \n"') # This is used to analyse the reply +HEXDUMPPLAIN=(hexdump -ve '1/1 "%.2x"') # Replaces both xxd -p and tr -cd '[:print:]' go2_column() { $ECHO "\033[${1}G"; } @@ -1044,7 +1045,7 @@ ccs_injection(){ if [ $VERBOSE -eq 1 ]; then outln "\n server hello:" - echo "$SOCKREPLY" | "${HEXDUMP[@]}" | head -20 + echo "$SOCKREPLY" | "${HEXDUMPVIEW[@]}" | head -20 outln "[...]" outln "payload with TLS version $tls_hexcode:" fi @@ -1056,7 +1057,7 @@ ccs_injection(){ if [ $VERBOSE -eq 1 ]; then outln "\n reply: " - echo "$SOCKREPLY" | "${HEXDUMP[@]}" + echo "$SOCKREPLY" | "${HEXDUMPVIEW[@]}" outln fi @@ -1159,7 +1160,7 @@ heartbleed(){ if [ $VERBOSE -eq 1 ]; then outln "\n server hello:" - echo "$SOCKREPLY" | "${HEXDUMP[@]}" | head -20 + echo "$SOCKREPLY" | "${HEXDUMPVIEW[@]}" | head -20 outln "[...]" outln " sending payload with TLS version $tls_hexcode:" fi @@ -1170,11 +1171,10 @@ heartbleed(){ if [ $VERBOSE -eq 1 ]; then outln "\n heartbleed reply: " - echo "$SOCKREPLY" | "${HEXDUMP[@]}" + echo "$SOCKREPLY" | "${HEXDUMPVIEW[@]}" outln fi - # iS - Does this need to be a different hexdump command? lines_returned=`echo "$SOCKREPLY" | "${HEXDUMP[@]}" | wc -l` if [ $lines_returned -gt 1 ]; then red "VULNERABLE"