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