summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2015-01-30 16:28:34 +0100
committerPeter Wu <peter@lekensteyn.nl>2015-01-30 16:28:34 +0100
commited3f3d954f472694e07aaa05493f5e29a6b2e388 (patch)
tree40ee16710fabd3e6da8798c15d00962d4ebec3b8
parent1123e936365c89d43e9f210872778d81223af36d (diff)
downloadwireshark-notes-ed3f3d954f472694e07aaa05493f5e29a6b2e388.tar.gz
Add sslkeylog.sh wrapper script
-rwxr-xr-xsrc/sslkeylog.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/sslkeylog.sh b/src/sslkeylog.sh
new file mode 100755
index 0000000..b5bac94
--- /dev/null
+++ b/src/sslkeylog.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+# Invokes the given command, displaying the pre-master secrets to stderr
+# (or to the file given by envvar SSLKEYLOGFILE).
+#
+# Example usage:
+# SSLKEYLOGFILE=premaster.txt ./sslkeylog.sh curl https://lekensteyn.nl/
+
+# Do not load the library into gdb or the shell launched by gdb. This prevent
+# crashes when the library is built with -fsanitize=address and such.
+gdb() {
+ export -n LD_PRELOAD
+ command gdb -q \
+ -ex 'set startup-with-shell off' \
+ -ex "set environment LD_PRELOAD=$LD_PRELOAD" \
+ "$@"
+}
+
+export LD_PRELOAD=$(dirname "$0")/libsslkeylog.so
+export SSLKEYLOGFILE=${SSLKEYLOGFILE:-/dev/stderr}
+
+# Run the command
+"$@"