diff options
-rwxr-xr-x | run-ws | 40 |
1 files changed, 40 insertions, 0 deletions
@@ -0,0 +1,40 @@ +#!/bin/sh + +if [ $# -lt 2 ]; then + echo "Usage: $0 /path/to/wireshark capture.pcapng [ssl debug file] [--] [other wireshark options]" + exit 1 +fi + +SSLKEYLOGFILE=${SSLKEYLOGFILE:-$PWD/premaster.txt} +WIRESHARK=$1 +CAPTFILE=$2 +SSLDEBUG= +shift 2 + +# set SSL debug file only if ssl debug file is given +case $1 in +-*|'') ;; +*) SSLDEBUG=$1 ; shift ;; +esac + +# -- marks end of our options and the begin of wireshark options +case $1 in +--) shift ;; +esac + +if [ ! -x "$WIRESHARK" ]; then + echo "$WIRESHARK: not an executable" + exit 1 +fi + +if [ ! -s "$CAPTFILE" ]; then + echo "$CAPTFILE: file is empty or does not exist" + exit 1 +fi + +[ -z "$SSLDEBUG" ] || set -- -o ssl.debug_file:"$SSLDEBUG" "$@" + +"$WIRESHARK" -r "$CAPTFILE" \ + -o http.ssl.port:443,4430-4433 \ + -o ssl.keylog_file:"$SSLKEYLOGFILE" \ + "$@" |