Advertisement
Guest User

Untitled

a guest
Mar 10th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. from cryptography.fernet import Fernet
  2.  
  3. USER = input('Paste API username: ')
  4. PWD = input('Paste API password: ')
  5. FQDN = input('Paste Server Name: ')
  6.  
  7. PATH = 'C://shared//API//credentials/EO/CUCM/'
  8.  
  9. FILE_FQDN = PATH + 'fqdn.txt'
  10. FILE_KEY = PATH + 'key_rx.txt'
  11. FILE_USER = PATH + 'user_rx.txt'
  12. FILE_PWD = PATH + 'hash_rx.txt'
  13.  
  14. ##Create the Symmetric Key
  15. key = Fernet.generate_key()
  16.  
  17. ##Create the Hash for PWD and write files
  18. cipher_suite = Fernet(key)
  19. ciphered_text = cipher_suite.encrypt(PWD.encode())
  20. with open(FILE_FQDN, 'w') as f: f.write(FQDN)
  21. with open(FILE_KEY, 'wb') as f: f.write(key)
  22. with open(FILE_USER, 'w') as f: f.write(USER)
  23. with open(FILE_PWD, 'wb') as f: f.write(ciphered_text)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement