Skip to content

Instantly share code, notes, and snippets.

@acdimalev
Created September 27, 2021 18:56
Show Gist options
  • Save acdimalev/719d4bf7bca58f4343aef8dd629f9c14 to your computer and use it in GitHub Desktop.
Save acdimalev/719d4bf7bca58f4343aef8dd629f9c14 to your computer and use it in GitHub Desktop.
randopass
#!/usr/bin/env python3
import crypt, random, sys
(_, nick) = sys.argv
password = '{:016x}'.format(random.randrange(256 ** 8))
crypted = crypt.crypt(password)
passwd_entry = ':'.join([nick, crypted])
sys.stderr.write(password + '\n')
sys.stdout.write(passwd_entry + '\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment