Skip to content

Instantly share code, notes, and snippets.

View geekpete's full-sized avatar
🫙
.

Peter Dyson geekpete

🫙
.
View GitHub Profile
@geekpete
geekpete / gist:7329085
Last active May 27, 2018 18:28
One line python command to generate a SHA512 password hash for use in linux shadow file including a randomised salt value. Change MySecretPassword to the password of your choice. Useful for generating password hashes to be used in puppet user manifests. This script is mildly idiotic. Bash will prevent any non-escaped characters being fed into py…
python -c "import random,string,crypt,getpass,pwd; randomsalt = ''.join(random.sample(string.ascii_letters,8)); print crypt.crypt('MySecretPassword', '\$6\$%s))\$' % randomsalt)"