pwgen/pwgenerator.py

29 lines
554 B
Python
Raw Normal View History

2022-03-25 17:03:28 +01:00
import random
lower = "abcdefghijklmnopqrstuvwxyz"
upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
numbers = "0123456789"
symbols = "!$%&/?+*-#"
def genNum(length):
gen(numbers, length)
def genLetLow(length):
gen(lower, length)
def genLetUp(length):
gen(upper, length)
def genLet(length):
gen(lower + upper, length)
def genLetNum(length):
gen(lower + upper + numbers, length)
def genFull(length):
gen(lower + upper + numbers + symbols, length)
def gen(chars, length):
print(''.join(random.choice(chars) for _ in range(length)))