SimplePassGen/password.py

29 lines
804 B
Python
Raw Normal View History

2022-05-28 22:01:53 +02:00
import os.path
2022-05-28 21:49:22 +02:00
import random
2022-05-28 22:22:34 +02:00
print("site name")
2022-05-28 21:49:22 +02:00
site = input()
chars = '+-/*!&$#?=@<>abcdefghijklnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'
2022-05-28 22:22:34 +02:00
length = int(input('len pass'+ "\n"))
2022-05-28 21:49:22 +02:00
password = ""
for i in range(length):
password += random.choice(chars)
a = random.randrange(len("mail"))
mail = list("lettele")
mail.insert(a, ".")
mail = ''.join(mail) + "@disroot.org"
print(mail)
print(password)
2022-05-28 22:01:53 +02:00
if os.path.exists("password.txt") == True:
file = open("password.txt", "a")
file.write(str(site) + "\n")
file.write(str(mail) + "\n")
file.write(str(password) + "\n")
file.write(" " + "\n")
file.close()
else:
file = open("password.txt", "w")
file.write(str(site) + "\n")
file.write(str(mail) + "\n")
file.write(str(password) + "\n")
file.write(" " + "\n")