diff options
author | Peter Wu <lekensteyn@gmail.com> | 2013-09-16 14:17:46 +0200 |
---|---|---|
committer | Peter Wu <lekensteyn@gmail.com> | 2013-09-16 14:17:46 +0200 |
commit | 290682f032b4516c11d8882bf27ec3dca9b750dd (patch) | |
tree | 60c6cc43c98b8b9d1d44b61d56f2a0415b50fb12 /openssl-connect | |
parent | 492adbe1c145156b094d5a0442cecb4715c739ba (diff) | |
download | wireshark-notes-290682f032b4516c11d8882bf27ec3dca9b750dd.tar.gz |
openssl-connect: print keys earlier
Diffstat (limited to 'openssl-connect')
-rwxr-xr-x | openssl-connect | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/openssl-connect b/openssl-connect index d4e2689..af6fa9b 100755 --- a/openssl-connect +++ b/openssl-connect @@ -9,7 +9,9 @@ s_client_client_random() { awk ' # match Master-Key from SSL Session dump /Master-Key:/{key=$2} - { + + # start matching bytes when requested + l > 0 { b=1;e=16; if(l==3)b=7; if(l==1)e=6; @@ -18,20 +20,26 @@ s_client_client_random() { # at the end, save random value in map r if (l--==1) - r[s]=1 + queued[s] = 1; } # Match block containing Crandom bytes (over three lines) / ClientHello|ServerHello$/{l=3;s=""} - END{ - has_random = 0; - for (rnd in r) { + # whenever a key and random is available, print it. This allows the random + # to be known before the connection is finished. + key { + for (rnd in queued) { has_random = 1; - if (key) - print "CLIENT_RANDOM", rnd, key - else - print "# No master key for random", rnd + print "CLIENT_RANDOM", rnd, key + delete queued[rnd]; + } + fflush(); + } + + END { + for (rnd in queued) { + print "# No master key for random", rnd } # should not be possible since the first thing we sent out is a # ClientHello, but just to be sure... |