Skip to content

Instantly share code, notes, and snippets.

@float-tw
Last active October 7, 2015 01:08
Show Gist options
  • Save float-tw/3081854 to your computer and use it in GitHub Desktop.
Save float-tw/3081854 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import string
import sys
from random import Random
if( len(sys.argv) > 1 ):
passwd_len = int(sys.argv[1])
else:
passwd_len = 8
if( len(sys.argv) > 2 ):
num = int(sys.argv[2])
else:
num = 1
for i in range(num):
char_set = ''.join(c for c in string.letters+string.digits if c not in "10oOlL")
newpasswd = ''.join( Random().sample(char_set, passwd_len) )
print newpasswd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment