Skip to content

Instantly share code, notes, and snippets.

@0xPr0xy
Created October 5, 2011 16:27
Show Gist options
  • Save 0xPr0xy/1264918 to your computer and use it in GitHub Desktop.
Save 0xPr0xy/1264918 to your computer and use it in GitHub Desktop.
password generator
from string import digits, ascii_letters
from random import choice
from sys import argv
def generator(length):
chac = digits + ascii_letters
pwd = list()
for p in range(length):
pwd.append(choice(chac))
print("".join(pwd))
def main():
try:
args = argv[1] #Terminal argument
#Run!! And don't forget to add the password lenght
generator(int(args))
except IndexError:
generator(12)
if __name__ == '__main__' : main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment