Last active
November 6, 2016 16:54
-
-
Save moisesguimaraes/d4c74fe548cf10a760d53395fd1476c9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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