Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #z3
- import sys
- import random
- import string
- from subprocess import check_output
- if len(sys.argv) < 4:
- print('Nie podałeś wszystkich argumentów')
- exit()
- file_path = sys.argv[1]
- username = sys.argv[2]
- password = sys.argv[3]
- salt = ''.join(random.choice(string.digits + string.ascii_letters) for _ in range(8))
- hashed_password = check_output(["openssl", "passwd", "-apr1", "-salt", salt, password]).decode('utf-8')
- with open(file_path, "a+") as ins:
- ins.write(username+hashed_password)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement