Script that generate passwords
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

61 lines
1.3 KiB

from random import choice
from os import system, name
chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()_+?><|":,'''
def mainMenu():
clear()
print("Password Generator\n")
print("1:A-z")
print("2:A-z-9")
print("3:A-z-9-}")
print("4:Exit")
inp = int(input('>:'))
if inp == 1:
pSymb = 52
Generator(pSymb)
elif inp == 2:
pSymb = 62
Generator(pSymb)
elif inp == 3:
pSymb = 81
Generator(pSymb)
elif inp == 4:
exit()
else:
mainMenu()
def Generator(pSymb):
clear()
pAmount = int(input('Amount:'))
pLength = int(input('Length:'))
pFile = input("File:")
for _ in range(pAmount):
password = ''
for _ in range(pLength):
password += choice(chars[:+pSymb])
if len(pFile) > 0:
with open(pFile + '.txt', 'a') as file:
file.write(password + '\n')
else:
print("\n" + password)
var = input('Generate again [Y/N]:')
if var == "Y" or "y":
mainMenu()
elif var == "N" or "n":
exit()
else:
exit()
def clear():
if name == 'posix':
system('clear')
else:
system('cls')
if __name__ == "__main__":
mainMenu()