Skip to content

Instantly share code, notes, and snippets.

@nick133
Created June 28, 2020 13:39
Show Gist options
  • Save nick133/533311bd28b7ba9885e4de1c89d489a5 to your computer and use it in GitHub Desktop.
Save nick133/533311bd28b7ba9885e4de1c89d489a5 to your computer and use it in GitHub Desktop.
GoogleAuthentificator (OTP-generator) for linux command line (python)
#!/usr/bin/python3
#
# Command line GoogleAuthentificator for linux
#
# pip3 install pyperclip
# pip3 install pyotp
#
import pyperclip
import pyotp
ga_keys = [
{ "provider": "Binance",
"key": "YOURPRIVATEOTPKEY1",
},
{ "provider": "Localbitcoins",
"key": "YOURPRIVATEOTPKEY2",
},
]
print("Generate Google Auth code for: [1]")
for i in range(len(ga_keys)):
print(f"{i+1} - {ga_keys[i]['provider']}")
id = int(input() or 1) - 1
code = pyotp.TOTP(ga_keys[id]['key']).now()
pyperclip.copy(code)
print (f"Code {code} is copied to clipboard\n\nPress <Enter> to exit")
id = input()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment