-
-
Save fangpsh/204f4dace96c20c8edf34ab47241cf94 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# brew install oath-toolkit | |
# | |
# ~/.otpkeys: | |
# name1=secret | |
# name2=secret | |
scriptname=`basename $0` | |
if [ -z $1 ] | |
then | |
echo "$scriptname: Service Name Req'd" | |
echo "" | |
echo "Usage:" | |
echo " otp google" | |
echo "" | |
echo "Configuration: $HOME/.otpkeys" | |
echo "Format: name=key" | |
exit | |
fi | |
otpkey=` grep ^$1= $HOME/.otpkeys | cut -d"=" -f 2 | sed "s/ //g" ` | |
if [[ -z $otpkey ]]; then | |
echo "$scriptname: Bad Service Name" | |
exit | |
fi | |
key=$(/usr/local/bin/oathtool --totp -b $otpkey) | |
printf $key | pbcopy | |
echo $key | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment