Skip to content

Instantly share code, notes, and snippets.

@zdrummond
Created February 28, 2019 21:16
Show Gist options
  • Select an option

  • Save zdrummond/9d90827b9b4b9b877f02328843c7fbbd to your computer and use it in GitHub Desktop.

Select an option

Save zdrummond/9d90827b9b4b9b877f02328843c7fbbd to your computer and use it in GitHub Desktop.
Command Line Two Factor
~/.otpkeys
----
aws={secret code}
google={secret code}
$ otp aws
310645
/usr/local/bin/otp
----
#!/usr/bin/env bash
if [ -z $1 ]; then
echo
echo "Usage:"
echo " otp google"
echo
echo "Configuration: $HOME/.otpkeys"
echo "Format: name=key"
exit
fi
OTPKEY=$(sed -n "s/${1}=//p" $HOME/.otpkeys)
if [ -z $OTPKEY ]; then
echo "$(basename $0): Bad Service Name '$1'"
$0
exit
fi
oathtool --totp -b $OTPKEY
@zdrummond
Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment