Advertisement
Guest User

z3

a guest
Nov 2nd, 2018
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.51 KB | None | 0 0
  1. #z3
  2.  
  3. import sys
  4. import random
  5. import string
  6. from subprocess import check_output
  7.  
  8.  
  9. if len(sys.argv) < 4:
  10.     print('Nie podałeś wszystkich argumentów')
  11.     exit()
  12.  
  13. file_path = sys.argv[1]
  14. username = sys.argv[2]
  15. password = sys.argv[3]
  16.  
  17. salt = ''.join(random.choice(string.digits + string.ascii_letters) for _ in range(8))
  18. hashed_password = check_output(["openssl", "passwd", "-apr1", "-salt", salt, password]).decode('utf-8')
  19.  
  20. with open(file_path, "a+") as ins:
  21.     ins.write(username+hashed_password)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement