summaryrefslogtreecommitdiff
path: root/openssl-connect
diff options
context:
space:
mode:
authorPeter Wu <lekensteyn@gmail.com>2013-10-27 12:03:05 +0100
committerPeter Wu <lekensteyn@gmail.com>2013-10-27 12:03:05 +0100
commitb597cfb5143b1b13ed8f5a64f142476a6f7eea9a (patch)
tree8b50a7601e905b3a5036d51574976600bda7cbf3 /openssl-connect
parentbdba74960ad6f24641b7f49b5c501c2b5c3e71db (diff)
downloadwireshark-notes-b597cfb5143b1b13ed8f5a64f142476a6f7eea9a.tar.gz
openssl-*: support custom s_server/s_client args
Diffstat (limited to 'openssl-connect')
-rwxr-xr-xopenssl-connect18
1 files changed, 15 insertions, 3 deletions
diff --git a/openssl-connect b/openssl-connect
index fa9b09a..4a977f7 100755
--- a/openssl-connect
+++ b/openssl-connect
@@ -2,11 +2,23 @@
# Connects to a SSL host for a list of ciphers
# Author: Peter Wu <lekensteyn@gmail.com>
-host=${1:-localhost}
-portbase=${2:-4430}
+host=localhost
+portbase=4430
PSK=12345678
PSK=0102030405060708091011121314151617181920
+# assume that openssl options always start with -
+if [[ $1 != -* ]]; then
+ host=$1; shift
+fi
+if [[ $1 != -* ]]; then
+ portbase=$1; shift
+ if ! [[ $portbase -gt 0 ]] || ! [[ $portbase -le 65535 ]]; then
+ echo "Port must be between 1 and 65535" >&2
+ exit 1
+ fi
+fi
+
s_client_client_random() {
awk '
# match Master-Key from SSL Session dump
@@ -101,7 +113,7 @@ while read cipher; do
openssl s_client -connect "$host:$port" -ign_eof -cipher "$cipher" \
-no_comp \
"${opts[@]}" \
- -msg 2>&1 | s_client_client_random
+ -msg "$@" 2>&1 | s_client_client_random
done
# vim: set et sw=4 ts=4: