add path argument for secret

master
Felix Pankratz 8 months ago
parent bded598a6e
commit f0e613919a

@ -30,15 +30,18 @@ def generate_seed(secret):
def main():
import argparse
parser = argparse.ArgumentParser(prog='Remote Admin Password Solution', description='Generate rotating passwords based on a shared secret')
parser.add_argument('--secret', action='store', help='path to secret file')
parser.add_argument('--new-secret', action='store_true', help='generate a new secret')
args = parser.parse_args()
secret_path = args.secret if args.secret else SECRET_FILE
secret = ''
if not os.path.isfile(SECRET_FILE) or args.new_secret:
if not os.path.isfile(secret_path) or args.new_secret:
print('Generating a new secret... ', end='')
secret = create_secret()
with open(SECRET_FILE, 'w') as f:
with open(secret_path, 'w') as f:
f.write(secret)
print('done. Send this to the other party:')
print(secret)

Loading…
Cancel
Save