summaryrefslogtreecommitdiff
path: root/run-ws
diff options
context:
space:
mode:
authorPeter Wu <lekensteyn@gmail.com>2013-12-06 00:08:26 +0100
committerPeter Wu <lekensteyn@gmail.com>2013-12-06 00:08:26 +0100
commitf10b17663bab369e8e88385c8c3406d3cc9f97e5 (patch)
tree58944aa51bd723417e9446dab66b053e9edccfbf /run-ws
parent403cfce4177cab791e29209f63f665d7170c20e3 (diff)
downloadwireshark-notes-f10b17663bab369e8e88385c8c3406d3cc9f97e5.tar.gz
run-ws: helper to run wireshark for SSL debugging
Example usage, assuming 'premaster.txt' in corrent directory: ./run-ws /tmp/wsbuild/tshark dump.pcapng Example, with filtering for SSL record type Application Data (23): ./run-ws /usr/bin/wireshark dump.pcapng.gz \ -Y ssl.record.content_type==23
Diffstat (limited to 'run-ws')
-rwxr-xr-xrun-ws40
1 files changed, 40 insertions, 0 deletions
diff --git a/run-ws b/run-ws
new file mode 100755
index 0000000..b9c46b6
--- /dev/null
+++ b/run-ws
@@ -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" \
+ "$@"