Skip to content

Instantly share code, notes, and snippets.

@moisesguimaraes
Last active November 6, 2016 16:54
Show Gist options
  • Save moisesguimaraes/d4c74fe548cf10a760d53395fd1476c9 to your computer and use it in GitHub Desktop.
Save moisesguimaraes/d4c74fe548cf10a760d53395fd1476c9 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import random
import string
chars = string.ascii_letters + string.digits + string.punctuation
def genpwd(length):
return ''.join(random.choice(chars) for _ in xrange(length))
if __name__ == '__main__':
if len(sys.argv) != 2:
print("usage: ./genpwd.py PASSWORD_LENGTH")
else:
print(genpwd(int(sys.argv[1])))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment