diff --git a/sh/get-cert.sh b/sh/get-cert.sh new file mode 100644 index 0000000..20f37be --- /dev/null +++ b/sh/get-cert.sh @@ -0,0 +1,22 @@ +#!/bin/sh +# +# usage: get-cert.sh remote-host [port] +# + +export PATH=/usr/local/Cellar/libressl/2.3.6/bin:$PATH + +REMHOST=$1 +REMPORT=${2:-443} + +echo |\ +openssl s_client -connect ${REMHOST}:${REMPORT} -servername ${REMHOST} 2>&1 |\ +sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /tmp/temp.crt +openssl x509 -noout -subject -dates -fingerprint -in /tmp/temp.crt +openssl x509 -in /tmp/temp.crt -issuer -noout | pcre2grep -o1 -o2 '(issuer=).*CN=(.*)' +openssl x509 -in /tmp/temp.crt -text -noout | grep -A1 "Subject Alternative Name" | sed s/DNS://g | sed s/^\ *//g | tr ',' '\n' +openssl x509 -in /tmp/temp.crt -noout -serial | gawk -F\= '{print "Serial number: ", $2, strtonum("0x"$2)}' +openssl x509 -in /tmp/temp.crt -text | grep "Signature Algorithm:" | tail -1 | xargs + + +#echo "" | gnutls-cli -p ${REMPORT} ${REMHOST} 2>/dev/null | grep subject | head -1 | sed -e $'s/, /\\\n/g' + diff --git a/sh/getTimes.sh b/sh/getTimes.sh new file mode 100755 index 0000000..aebd91f --- /dev/null +++ b/sh/getTimes.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +MYDATE=$1 +MYTIEM=$2 +EPOCH=$(date -d "$1 $2" +%s) + +for z in Asia/Hong_Kong Asia/Tokyo US/Eastern US/Pacific US/Central UTC Europe/London Europe/Berlin Asia/Kolkata Australia/Sydney; do + echo -n "$z | " + TZ=$z date -d "@$EPOCH" +done