Created
September 15, 2020 09:26
-
-
Save immanuelpotter/15205ac5a410e080d933e3f9a9d85660 to your computer and use it in GitHub Desktop.
Get MFA code for a TOTP String, right now
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# https://github.com/pyotp/pyotp | |
import pyotp | |
import argparse | |
parser = argparse.ArgumentParser(description='Get the TOTP code, for an MFA string, right now.') | |
parser.add_argument('mfa_string', metavar='mfa_string', type=str, help='The MFA string to get the current totp code for.') | |
args = parser.parse_args() | |
mfa_string = args.__dict__["mfa_string"] | |
totp = pyotp.TOTP(mfa_string) | |
print(totp.now()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment