#!/usr/bin/env python
import random
import string
import sys
similar_char = '0OoiI1LpP'
upper = ''.join(set(string.uppercase) - set(similar_char))
lower = ''.join(set(string.lowercase) - set(similar_char))
symbols = '!#$%&\*+,-./:;=?@^_`~'
numbers = '123456789'
group = (upper, lower, symbols, numbers)
def getpass(lenth=8):
pw = [random.choice(i) for i in group]
con = ''.join(group)
for i in range(lenth-len(pw)):
pw.append(random.choice(con))
random.shuffle(pw)
return ''.join(pw)
genpass = getpass(int(sys.argv[1]))
print genpass
#!/usr/bin/env python
import random
import string
def GenPassword(length):
chars=string.ascii_letters+string.digits
return ''.join([random.choice(chars) for i in range(length)])
if __name__=="__main__":
for i in range(10):
print GenPassword(15)