Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from cryptography.fernet import Fernet
- USER = input('Paste API username: ')
- PWD = input('Paste API password: ')
- FQDN = input('Paste Server Name: ')
- PATH = 'C://shared//API//credentials/EO/CUCM/'
- FILE_FQDN = PATH + 'fqdn.txt'
- FILE_KEY = PATH + 'key_rx.txt'
- FILE_USER = PATH + 'user_rx.txt'
- FILE_PWD = PATH + 'hash_rx.txt'
- ##Create the Symmetric Key
- key = Fernet.generate_key()
- ##Create the Hash for PWD and write files
- cipher_suite = Fernet(key)
- ciphered_text = cipher_suite.encrypt(PWD.encode())
- with open(FILE_FQDN, 'w') as f: f.write(FQDN)
- with open(FILE_KEY, 'wb') as f: f.write(key)
- with open(FILE_USER, 'w') as f: f.write(USER)
- with open(FILE_PWD, 'wb') as f: f.write(ciphered_text)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement