Quicksilver and OTP: Together At Last
Monday 15 December 2014 at 11:57 pmI’ve been using Two-Factor Authentication on most every site that supports it for a while now: Google, Evernote, Facebook and Dropbox to name a few. But I’ve always grumbled when I’m on my laptop and I need to log into one of these accounts and they are asking for my TFA token.
Now I’ve got it working where I can get the latest token for any of these services on my Mac in Quicksilver and copied to my clipboard in no time flat. You can have it working for yourself in just a few minutes.
First off, requirements:
- oath-toolkit (I used “brew install oath-toolkit” after installing brew)
- Quicksilver
- Quicksilver’s Terminal Plugin
Once you’ve installed everything, put this code in a file named “otp” in your ~/bin/ folder and make sure it is in your path.
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
/usr/local/bin/oathtool —totp -b $otpkey
Now you need to put your special keys (you kept them handy and encrypted somewhere, right?) into a special, you-read-only file in your home dir named .otpkeys. Make sure you chmod 600 .otpkeys so nobody can snoop ‘em! Here’s what it should look like:
It isn’t the most secure implementation but it gets the job done. I considered putting the keys/config into a Keychain item and use /usr/bin/security to access them, maybe more securely.
Now run it!
And the result.
Enjoy!
August 2017 Xbox Live Games with Gold: Slime Rancher, Trials Fusion, Bayonetta and Red Faction: Armageddon
Microsoft is now officially announced August’s 2017 Games with Xbox Live Gold, includes: Slime Rancher, Trails Fusion, Bayonetta and Red Faction: Armageddon, provides over $89 dollars in value and up to 4000 gamerscore. Both Bayonetta and Red Fac…
Sent on 27 07 17 - 02:37 , via PUPUWEB
Trackback link:Please enable javascript to generate a trackback url