A simple command line pyotp wrapper
This file contains 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
import argparse | |
import json | |
import pyotp | |
def main(): | |
parser = argparse.ArgumentParser() | |
parser.add_argument('json', nargs=1) | |
parser.add_argument('key', nargs=1) | |
args = parser.parse_args() | |
with open(args.json[0]) as f: | |
j = json.load(f) | |
seed = j.get(args.key[0]) | |
if seed: | |
totp = pyotp.TOTP(seed) | |
print(totp.now()) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment