| OLD | NEW |
| (Empty) | |
| 1 #!/bin/bash |
| 2 |
| 3 set -e |
| 4 |
| 5 if [ $# -ne 2 ] ; then |
| 6 echo "This tool will extract all of the certificates in a CertificateTranspare
ncy database and write their raw DER to a single file. This is the input file fo
r cert_mapper" |
| 7 echo "" |
| 8 echo "Usage: <input-path-to-ct-db> <output-path-to-dump>" |
| 9 exit 1 |
| 10 fi |
| 11 |
| 12 # Make sure GO is installed |
| 13 go version >/dev/null 2>&1 || { echo >&2 "ERROR: Need to have GO installed"; exi
t 1; } |
| 14 |
| 15 CT_DB_INPUT="$(readlink -f "$1")" |
| 16 OUT_PATH="$(readlink -f "$2")" |
| 17 |
| 18 ORIGINAL_GO_FILE=$( readlink -f "$(dirname "$0")/dump-ct.go" ) |
| 19 |
| 20 MY_DIR=$(mktemp -d) |
| 21 |
| 22 echo "Created temporary directory: $MY_DIR" |
| 23 |
| 24 cd "$MY_DIR" |
| 25 export GOPATH="$MY_DIR" |
| 26 |
| 27 echo "Downloading agl's certificatetransparency code into $MY_DIR" |
| 28 go get github.com/agl/certificatetransparency |
| 29 |
| 30 mkdir mycttools |
| 31 DST_GO_FILE="mycttools/dump-ct.go" |
| 32 echo "Copying to $ORIGINAL_GO_FILE to $MY_DIR/$DST_GO_FILE" |
| 33 cp "$ORIGINAL_GO_FILE" "$MY_DIR/$DST_GO_FILE" |
| 34 |
| 35 echo "Executing dump-ct.go" |
| 36 go run "$DST_GO_FILE" "$CT_DB_INPUT" "$OUT_PATH" |
| 37 |
| 38 # Cleanup this temporary directory. |
| 39 echo "Cleaning up and deleting $MY_DIR" |
| 40 rm -rf "$MY_DIR" |
| OLD | NEW |