Dear Internet, Today I Learned that oath-toolkit exists in Homebrew.
So, this is a thing:
$ brew install oath-toolkit $ alias totp='oathtool --totp -b YOURSECRET32BLA | pbcopy'
And so is this:
#! /usr/bin/env expect -f set totp [ exec oathtool --totp -b MYSECRET7W22 ] spawn ssh verysecure.doma.in expect "Password:" sleep 1 send "thisIsN0t1GoodPaszwort@\r" expect "Two Factor Token:" sleep 1 send "$totp\n" interact
Yup, it’s totally possible to laugh and cry at the same time.