Skip to content

Instantly share code, notes, and snippets.

@davidlc9113
Last active December 14, 2018 06:35
Show Gist options
  • Select an option

  • Save davidlc9113/5d1f59dc09d87894d5e9ad74e3f2c4e7 to your computer and use it in GitHub Desktop.

Select an option

Save davidlc9113/5d1f59dc09d87894d5e9ad74e3f2c4e7 to your computer and use it in GitHub Desktop.
Get Google Authenticator code by secret key
#!/usr/bin/env python3
"""
Install dependencies from https://gist.github.com/dlc9113/eb2b7410b105858bbbed8d80d9a5217d
# Output the code
$ googleauth your_secret_key
# (Mac only) Copy the code
$ googleauth your_secret_key | pbcopy
"""
import pyotp, sys
secret_code = sys.argv[-1]
print(pyotp.TOTP(secret_code).now())
@davidlc9113
Copy link
Author

davidlc9113 commented Dec 14, 2018

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