diff --git a/utils/create_user_password.py b/utils/create_user_password.py new file mode 100644 index 0000000000000000000000000000000000000000..19435d5ce1210526afa3053ada71ba99f0d43635 --- /dev/null +++ b/utils/create_user_password.py @@ -0,0 +1,42 @@ +""" +create an encrypted password for a DestinE AQ (Core) User +========================================================= + + - encrypt a given password with the Fernet key used in the DestinE AQ GUI + + author: + s.schroeder@fz-juelich.de + + date: 2024/02/27 + + call: + python create_user_password.py aWonderfulPassword +""" + +__author__ = "Sabine Schroeder" +__version__ = "0.9" +__maintainer__ = "Sabine Schroeder" +__email__ = "s.schroeder@fz-juelich.de" + + +from cryptography.fernet import Fernet +from deployment_settings import KEY +import argparse + + +if __name__ == "__main__": + # get command line arguments + # instantiate the parser + parser = argparse.ArgumentParser(description='This app encrypts a given password with the Fernet key used in the DestinE AQ GUI') + + # add arguments (required positional arguments) + parser.add_argument('password', type=str, help='password to be encrypted') + + # parse the args + args = parser.parse_args() + + # assign command line arguments + password = args.password + + fernet = Fernet(KEY) + print(fernet.encrypt(password.encode()))