Code: Alles auswählen
from tkinter import *
import tkinter as tk
import random
root = tk.Tk()
validation = (root.register(str.isdigit), '%S')
tk.Label(root, text='Länge des Passwortes').pack()
entry = tk.Entry(root, validate="key", validatecommand=validation)
entry.pack()
var1 = tk.IntVar()
var2 = tk.IntVar()
var3 = tk.IntVar()
var4 = tk.IntVar()
var5 = tk.IntVar()
var6 = tk.IntVar()
checkbox01 = tk.Checkbutton(root, text="Großbuchstaben", onvalue=1, offvalue=0)
checkbox01.pack()
checkbox02 = tk.Checkbutton(root, text="Kleinbuchstaben", onvalue=1, offvalue=0)
checkbox02.pack()
checkbox03 = tk.Checkbutton(root, text="Zahlen", onvalue=1, offvalue=0)
checkbox03.pack()
checkbox04 = tk.Checkbutton(root, text="Sonderzeichen", onvalue=1, offvalue=0)
checkbox04.pack()
checkbox05 = tk.Checkbutton(root, text="BesondereGroßbuchstaben", onvalue=1, offvalue=0)
checkbox05.pack()
checkbox06 = tk.Checkbutton(root, text="BesondereKleinbuchstaben", onvalue=1, offvalue=0)
checkbox06.pack()
Button1 = tk.Button(root, text="Aktion durchführen", command=passgen)
Button1.pack()
Button2 = tk.Button(root, text="Neues Password", command=newpw)
Button2.pack()
BL = ["Q", "W", "E", "R", "T", "Z", "U", "I", "O", "P", "A", "S", "D", "F", "G", "H", "J", "K", "L", "Y", "X", "C", "V", "B", "N", "M"]
sL = ["q", "w", "e", "r", "r", "z", "u", "i", "o", "p", "a", "s", "d", "f", "g", "h", "j", "k", "l", "y", "x", "c", "v", "b", "n", "M", "ß"]
Za = ["1","2","3","4","5","6","7","8","9","0"]
SZa = [".", ":", ",", ";", "#", "+", "*", "~", "-", "_", "!", "@", "§", "$", "%", "&", "/", "?", "€", "|"]
BLS = ["Ä", "Ü", "Ö"]
sLS = ["ü", "ä", "ö"]
PwO = []
length = entry.get()
pw = random.sample(PwO,length)
password = "".join(pw)
print(password)
def passgen():
if (var1.get() == 1) or (checkbox01.get() == 1):
PwO.extend(BL)
print("hey")
if (var2.get() == 1) or (checkbox02.get() == 1):
PwO.extend(sL)
print("how")
if (var3.get() == 1) or (checkbox03.get() == 1):
PwO.extend(Za)
print("are")
if (var4.get() == 1) or (checkbox04.get() == 1):
PwO.extend(SZa)
print("you")
if (var5.get() == 1) or (checkbox05.get() == 1):
PwO.extend(BLS)
print("little")
if (var6.get() == 1) or (checkbox06.get() == 1):
PwO.extend(sLS)
print("fella")
def newpw():
del PwO[:]
entry.delete()
root.mainloop()