lookup.sh 359 Bytes
Newer Older
1 2 3 4 5 6
#!/bin/bash

url="$1"
if [ $# -eq 1 ]; then
  read line
  fingerprint=$(ssh-keygen -lf /dev/stdin <<< $line | cut -f2 -d' ')
7
  exec curl -s -G "$url" --data-urlencode "fingerprint=${fingerprint}"
8 9
elif [ $# -eq 2 ]; then
  username="$2"
10
  exec curl -s -G "$url" --data-urlencode "username=${username}"
11 12 13 14
else
  echo "Invalid number of arguments" >&2
  exit 2
fi