Compare commits
No commits in common. "clear-stable" and "main" have entirely different histories.
clear-stab
...
main
58
Passgen.py
Normal file
58
Passgen.py
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
from secrets import choice # Для безопасной генерации пароля
|
||||||
|
from pyperclip import copy# Для копирования в буфер обмена
|
||||||
|
|
||||||
|
numbers=['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
|
||||||
|
lettersB=['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ]
|
||||||
|
lettersS=["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r","s", "t", "u", "v", "w", "x", "y", "z"]
|
||||||
|
special=[ "!", "@", "№", "#", "$", "%", "^", "|", "&", "*", "_", "-", "=", "+", "-", "/", "(", ")", "?", "{", "}", "[", "]", "~", ">", "<", "." ]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
lineal=int(input("Длина пароля: "))
|
||||||
|
number=input("Использовать числа? [Д/н] ")
|
||||||
|
letterB=input("Использовать большие буквы? [Д/н] ")
|
||||||
|
letterS=input("Использовать маленькие буквы? [Д/н] ")
|
||||||
|
spec=input("Использовать спец символы? [Д/н] ")
|
||||||
|
variables=[number,letterB,letterS,spec]
|
||||||
|
for i in range(len(variables)):
|
||||||
|
if variables[i] =="Д":
|
||||||
|
variables[i]=True
|
||||||
|
if variables[i] =="н":
|
||||||
|
variables[i]=False
|
||||||
|
number,letterB,letterS,spec=variables[0],variables[1],variables[2],variables[3]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def alph_generate(number,letterB,letterS,spec):
|
||||||
|
password_lst=[] # Создаём алфавит пароля
|
||||||
|
if number==True:
|
||||||
|
password_lst+=numbers
|
||||||
|
if letterB==True:
|
||||||
|
password_lst+=lettersB
|
||||||
|
if letterS==True:
|
||||||
|
password_lst+=lettersS
|
||||||
|
if spec==True:
|
||||||
|
password_lst+=special
|
||||||
|
return password_lst
|
||||||
|
|
||||||
|
def pass_generate(password_lst,lineal):
|
||||||
|
password=[] # Создаём непосредственно пароль
|
||||||
|
for i in range(lineal):
|
||||||
|
password.append(choice(password_lst))
|
||||||
|
password=''.join(password)
|
||||||
|
return password
|
||||||
|
|
||||||
|
def pass_copy(copys,password):
|
||||||
|
if copys==True:
|
||||||
|
copy(password)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
password_lst=alph_generate(number,letterB,letterS,spec)
|
||||||
|
password=pass_generate(password_lst,lineal)
|
||||||
|
print(password)
|
||||||
|
if(input("Скопировать в буфер обмена? [Д/н] ")=="Д") :
|
||||||
|
copys=True
|
||||||
|
else:
|
||||||
|
copys=False
|
||||||
|
pass_copy(copys)
|
||||||
@ -1,44 +0,0 @@
|
|||||||
from pyperclip import copy# Для копирования в буфер обмена
|
|
||||||
from logics.entropy import get_entopy
|
|
||||||
from logics.qr import generate_qr_text
|
|
||||||
from logics.generate import alph_generate,pass_generate
|
|
||||||
|
|
||||||
soglasie=["yes","y","д","да"]
|
|
||||||
while True:
|
|
||||||
try:
|
|
||||||
lineal=int(input("Длина пароля: "))
|
|
||||||
break
|
|
||||||
except ValueError:
|
|
||||||
print("Это должно быть число!")
|
|
||||||
while True:
|
|
||||||
number=input("Использовать числа? [Д/н] ")
|
|
||||||
letterB=input("Использовать большие буквы? [Д/н] ")
|
|
||||||
letterS=input("Использовать маленькие буквы? [Д/н] ")
|
|
||||||
spec=input("Использовать спец символы? [Д/н] ")
|
|
||||||
variables=[number.lower(),letterB.lower(),letterS.lower(),spec.lower()]
|
|
||||||
|
|
||||||
for i in range(len(variables)):
|
|
||||||
if variables[i] in soglasie:
|
|
||||||
variables[i]=True
|
|
||||||
else:
|
|
||||||
variables[i]=False
|
|
||||||
number,letterB,letterS,spec=variables[0],variables[1],variables[2],variables[3]
|
|
||||||
if True in variables:
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
print("Пустой пароль!")
|
|
||||||
password_lst=alph_generate(number,letterB,letterS,spec)
|
|
||||||
password=pass_generate(password_lst,lineal)
|
|
||||||
print(password)
|
|
||||||
entropy,state=get_entopy(password)
|
|
||||||
entropy_data=str(entropy)+" bits, "+state
|
|
||||||
print(entropy_data)
|
|
||||||
if(input("Скопировать в буфер обмена? [Д/н] ").lower() in soglasie) :
|
|
||||||
copy(password)
|
|
||||||
else:
|
|
||||||
pass
|
|
||||||
if(input("Создать QR код? [Д/н] ").lower() in soglasie) :
|
|
||||||
generate_qr_text(password)
|
|
||||||
else:
|
|
||||||
pass
|
|
||||||
|
|
||||||
229
PassgenGUI.py
229
PassgenGUI.py
@ -1,229 +0,0 @@
|
|||||||
from customtkinter import CTk,CTkLabel,CTkButton,CTkEntry,CTkCheckBox,CTkTabview,get_appearance_mode
|
|
||||||
from logics.generate import alph_generate,pass_generate
|
|
||||||
from tkinter import IntVar,END,PhotoImage
|
|
||||||
from logics.qr import generate_qr
|
|
||||||
import os
|
|
||||||
from logics.entropy import get_entopy
|
|
||||||
|
|
||||||
window=CTk()
|
|
||||||
window.title("Passgen by anqude")
|
|
||||||
window.geometry("350x220")
|
|
||||||
window.resizable(width=False, height=False)
|
|
||||||
theme=get_appearance_mode()
|
|
||||||
if theme=="Dark":
|
|
||||||
bg_color="#242424"
|
|
||||||
fg_color="#dbdbdb"
|
|
||||||
else:
|
|
||||||
fg_color="#242424"
|
|
||||||
bg_color="#dbdbdb"
|
|
||||||
|
|
||||||
scriptdir=os.path.abspath(__file__)
|
|
||||||
os.chdir(scriptdir.removesuffix('/PassgenGUI.py'))
|
|
||||||
window.tk.call('wm', 'iconphoto', window._w, PhotoImage(file='./ui/icon.png'))
|
|
||||||
|
|
||||||
tabview = CTkTabview(window)
|
|
||||||
tabview.pack(fill="both", expand=True,anchor='center')
|
|
||||||
|
|
||||||
tabview.add("Line") # add tab at the end
|
|
||||||
tabview.add("Graph") # add tab at the end
|
|
||||||
tabview.set("Line") # set currently visible tab
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
counter=8
|
|
||||||
|
|
||||||
def Checkvariables():
|
|
||||||
password_lst=alph_generate(Chnumber.get(),ChletterB.get(),ChletterS.get(),Chspec.get())
|
|
||||||
return password_lst
|
|
||||||
|
|
||||||
|
|
||||||
def testVal(inStr):
|
|
||||||
if inStr!="":
|
|
||||||
strong=get_entopy(inStr)
|
|
||||||
Entropy.configure(text=" Strength: "+str(strong[0])+" bits, "+strong[1])
|
|
||||||
return True
|
|
||||||
else:
|
|
||||||
Entropy.configure(text=" Strength:",width = 180)
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
entry=CTkEntry(tabview.tab("Line"),width = 320,validate="key")
|
|
||||||
entry.configure(validatecommand = (entry.register(testVal),'%P'))
|
|
||||||
entry.pack(padx=14, pady=15, fill="x")
|
|
||||||
|
|
||||||
Entropy =CTkLabel(tabview.tab("Line"),text=" Strength: ",width = 180,anchor="w")
|
|
||||||
Entropy.place(x=135, y=100)
|
|
||||||
|
|
||||||
Chspec = IntVar()
|
|
||||||
CheckCpec = CTkCheckBox(tabview.tab("Line"),text='@~#',variable=Chspec, onvalue=True, offvalue=False)
|
|
||||||
CheckCpec.place(x=14, y=60)
|
|
||||||
|
|
||||||
ChletterB = IntVar()
|
|
||||||
CheckLetterB = CTkCheckBox(tabview.tab("Line"),text='A-Z',variable=ChletterB, onvalue=True, offvalue=False)
|
|
||||||
CheckLetterB.place(x=94, y=60)
|
|
||||||
|
|
||||||
ChletterS = IntVar()
|
|
||||||
CheckLetterS = CTkCheckBox(tabview.tab("Line"),text='a-z',variable=ChletterS, onvalue=True, offvalue=False)
|
|
||||||
CheckLetterS.place(x=174, y=60)
|
|
||||||
|
|
||||||
Chnumber = IntVar()
|
|
||||||
CheckNumber = CTkCheckBox(tabview.tab("Line"),text='0-9',variable=Chnumber, onvalue=True, offvalue=False)
|
|
||||||
CheckNumber.select()
|
|
||||||
CheckNumber.place(x=254, y=60)
|
|
||||||
|
|
||||||
def minus_click():
|
|
||||||
counter=int(counter_entry.get())
|
|
||||||
if counter==1:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
counter-=1
|
|
||||||
counter_entry.delete(0, END)
|
|
||||||
counter_entry.insert(0, counter)
|
|
||||||
|
|
||||||
minus = CTkButton(tabview.tab("Line"),text="-",command=minus_click,width = 27)
|
|
||||||
minus.place(x=12, y=100)
|
|
||||||
|
|
||||||
|
|
||||||
counter_entry=CTkEntry(tabview.tab("Line"),width = 40)
|
|
||||||
counter_entry.insert(0, counter)
|
|
||||||
counter_entry.place(x=47, y=100)
|
|
||||||
|
|
||||||
|
|
||||||
def plus_click():
|
|
||||||
counter=int(counter_entry.get())
|
|
||||||
counter+=1
|
|
||||||
counter_entry.delete(0, END)
|
|
||||||
counter_entry.insert(0, counter)
|
|
||||||
plus = CTkButton(tabview.tab("Line"),text="+",command=plus_click,width = 27)
|
|
||||||
plus.place(x=95, y=100)
|
|
||||||
|
|
||||||
|
|
||||||
def generate_line():
|
|
||||||
entry.delete(0, END)
|
|
||||||
try:
|
|
||||||
password=pass_generate(Checkvariables(),int(counter_entry.get()))
|
|
||||||
entry.insert(0, password)
|
|
||||||
except:
|
|
||||||
entry.insert(0, "")
|
|
||||||
button=CTkButton(tabview.tab("Line"),text="Generate pass!", command=generate_line,width = 39)
|
|
||||||
button.place(x=12, y=140)
|
|
||||||
|
|
||||||
|
|
||||||
def copy_click():
|
|
||||||
from pyperclip import copy
|
|
||||||
copy(entry.get())
|
|
||||||
Copy = CTkButton(tabview.tab("Line"),text="Copy!",command=copy_click, width = 39)
|
|
||||||
Copy.place(x=122, y=140)
|
|
||||||
|
|
||||||
def genadiy():
|
|
||||||
state=generate_qr(entry.get(),fg_color,bg_color)
|
|
||||||
from tkinter import Toplevel,Label
|
|
||||||
from PIL import ImageTk, Image
|
|
||||||
if state==True:
|
|
||||||
window = Toplevel()
|
|
||||||
window.geometry("200x200")
|
|
||||||
window.configure(bg=bg_color)
|
|
||||||
window.title("QR")
|
|
||||||
window.tk.call('wm', 'iconphoto', window._w, PhotoImage(file='qr.png'))
|
|
||||||
bg = ImageTk.PhotoImage(file="qr.png")
|
|
||||||
label = Label(window,background=bg_color,highlightbackground=bg_color)
|
|
||||||
label.pack(fill="both", expand=True,anchor='center')
|
|
||||||
counter_loop=[0]
|
|
||||||
def resize_image(win):
|
|
||||||
if counter_loop[0]%3==0:
|
|
||||||
image = Image.open("qr.png")
|
|
||||||
size=min(win.width,win.height)
|
|
||||||
resized = image.resize((size, size))
|
|
||||||
image2 = ImageTk.PhotoImage(resized)
|
|
||||||
window.image2=image2
|
|
||||||
label.configure(image=image2)
|
|
||||||
counter_loop.insert(0,counter_loop[0]+1)
|
|
||||||
window.bind("<Configure>", resize_image)
|
|
||||||
window.mainloop()
|
|
||||||
else:
|
|
||||||
window = Toplevel()
|
|
||||||
window.configure(bg=bg_color)
|
|
||||||
window.title("Warning!")
|
|
||||||
window.tk.call('wm', 'iconphoto', window._w, PhotoImage(file='./ui/warn.png'))
|
|
||||||
label = Label(window,background=bg_color,highlightbackground=bg_color,text="Too much data to make QR!",foreground=fg_color,font=("Monospace",16))
|
|
||||||
label.pack(fill="both", expand=True,anchor='center')
|
|
||||||
window.attributes('-topmost', True)
|
|
||||||
window.update()
|
|
||||||
window.mainloop()
|
|
||||||
|
|
||||||
genqr = CTkButton(tabview.tab("Line"),text="Generate QR!",command=genadiy,width = 39)
|
|
||||||
genqr.place(x=175, y=140)
|
|
||||||
|
|
||||||
from logics.graph import ggraph,anonim
|
|
||||||
|
|
||||||
label1=CTkLabel(tabview.tab("Graph"),text="X",)
|
|
||||||
label1.place(x=60, y=15)
|
|
||||||
|
|
||||||
|
|
||||||
x_entry=CTkEntry(tabview.tab("Graph"),width=100)
|
|
||||||
x_entry.place(x=14, y=45)
|
|
||||||
|
|
||||||
Label3=CTkLabel(tabview.tab("Graph"),text="Y",)
|
|
||||||
Label3.place(x=170, y=15)
|
|
||||||
|
|
||||||
y_entry=CTkEntry(tabview.tab("Graph"),width=100)
|
|
||||||
y_entry.place(x=125, y=45)
|
|
||||||
|
|
||||||
label3=CTkLabel(tabview.tab("Graph"),text="Length")
|
|
||||||
label3.place(x=265, y=15)
|
|
||||||
|
|
||||||
len_entry=CTkEntry(tabview.tab("Graph"),width=100)
|
|
||||||
len_entry.place(x=235, y=45)
|
|
||||||
|
|
||||||
x_entry.insert(0, 3)
|
|
||||||
y_entry.insert(0,3)
|
|
||||||
len_entry.insert(0,4)
|
|
||||||
|
|
||||||
def gena():
|
|
||||||
n=int(len_entry.get())
|
|
||||||
yn=int(y_entry.get())
|
|
||||||
xn=int(x_entry.get())
|
|
||||||
from tkinter import Canvas, Toplevel, Label
|
|
||||||
if not ( n<=1 or n>xn*yn):
|
|
||||||
root = Toplevel()
|
|
||||||
root.configure(background="#242424")
|
|
||||||
root.title("Graph")
|
|
||||||
root.geometry("200x200")
|
|
||||||
root.tk.call('wm', 'iconphoto', root._w, PhotoImage(file='./ui/graph.png'))
|
|
||||||
resx,resy=400,400
|
|
||||||
canvas = Canvas(root,background=bg_color,highlightbackground=bg_color)
|
|
||||||
canvas.pack(fill="both", expand=True)
|
|
||||||
a=ggraph(n, xn, yn)
|
|
||||||
Xcoordinates,Ycoordinates,Xnull_coordinates,Ynull_coordinates=anonim(n,xn,yn,a,resx,resy)
|
|
||||||
def draw(n,xn,yn,Xcoordinates,Ycoordinates,Xnull_coordinates,Ynull_coordinates):
|
|
||||||
for i in range (xn): #кол-во линий
|
|
||||||
for j in range(yn): #кол-во строк
|
|
||||||
canvas.create_oval(Xnull_coordinates[i]-3,Ynull_coordinates[j]-3,Xnull_coordinates[i]+3,Ynull_coordinates[j]+3,width=7,fill=fg_color,outline="#565b5e")
|
|
||||||
|
|
||||||
for i in range (n-1): #Кол-во точек -1 тк это линии лол
|
|
||||||
canvas.create_line(Xcoordinates[i], Ycoordinates[i], Xcoordinates[i+1], Ycoordinates[i+1],width=7,arrow="last",fill=fg_color)
|
|
||||||
draw(n,xn,yn,Xcoordinates,Ycoordinates,Xnull_coordinates,Ynull_coordinates)
|
|
||||||
def sizable(event):
|
|
||||||
resx,resy = event.width, event.height
|
|
||||||
canvas.delete("all")
|
|
||||||
Xcoordinates,Ycoordinates,Xnull_coordinates,Ynull_coordinates=anonim(n,xn,yn,a,resx,resy)
|
|
||||||
draw(n, xn, yn,Xcoordinates,Ycoordinates,Xnull_coordinates,Ynull_coordinates)
|
|
||||||
|
|
||||||
canvas.bind('<Configure>', sizable)
|
|
||||||
root.mainloop()
|
|
||||||
else:
|
|
||||||
root = Toplevel()
|
|
||||||
root.configure(bg=bg_color)
|
|
||||||
root.title("Warning!")
|
|
||||||
root.tk.call('wm', 'iconphoto', root._w, PhotoImage(file='./ui/warn.png'))
|
|
||||||
label = Label(root,background=bg_color,highlightbackground=bg_color,text="Incorrect length!",foreground=fg_color,font=("Monospace",16))
|
|
||||||
label.pack(fill="both", expand=True,anchor='center')
|
|
||||||
root.attributes('-topmost', True)
|
|
||||||
root.update()
|
|
||||||
root.mainloop()
|
|
||||||
|
|
||||||
|
|
||||||
generate_graph=CTkButton(tabview.tab("Graph"),command=gena, text="Generate!",width=320)
|
|
||||||
generate_graph.place(x=15, y=95)
|
|
||||||
|
|
||||||
window.mainloop()
|
|
||||||
23
README.md
23
README.md
@ -5,27 +5,26 @@
|
|||||||
### Dependencies
|
### Dependencies
|
||||||
**Python**
|
**Python**
|
||||||
```sh
|
```sh
|
||||||
pip install tk pyperclip qrcode customtkinter password-strength
|
pip install tk pyperclip qrcode
|
||||||
```
|
```
|
||||||
|
|
||||||
**On debian**
|
**On debian**
|
||||||
```sh
|
```sh
|
||||||
sudo apt install python3-tk python3-pil.imagetk xclip
|
sudo apt install python3-tk python3-pil.imagetk
|
||||||
```
|
```
|
||||||
|
|
||||||
**On fedora**
|
**On fedora**
|
||||||
```sh
|
```sh
|
||||||
sudo dnf install python3-tkinter python3-pillow-tk xclip
|
sudo dnf install python3-tkinter python3-pillow-tk
|
||||||
```
|
```
|
||||||
### Screenshots
|
|
||||||
<img src="https://imgur.com/UJ9FeLK.png" alt="img" align="left" width="200px">
|
<img src="https://i.imgur.com/KUsAunA.png" alt="img" align="right" width="150px">
|
||||||
<img src="https://imgur.com/K1Zg6bv.png" alt="img" width="200px">
|
<img src="https://i.imgur.com/IYXMmxQ.png" alt="img" align="right" width="200px">
|
||||||
<img src="https://imgur.com/CGmd5cZ.png" alt="img" align="left" width="150px">
|
|
||||||
<img src="https://imgur.com/Plrrmzy.png" alt="img" width="150px">
|
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
- using custom password
|
|
||||||
- copy password to clipboard
|
- using cusom passassword
|
||||||
|
- copy passwoed to clipboard
|
||||||
- share password via QR code
|
- share password via QR code
|
||||||
- support dark and light system themes
|
|
||||||
- generate graphic key
|
|
||||||
|
|||||||
107
front.py
Normal file
107
front.py
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
from tkinter import Tk,ttk,Label,Button,Entry,IntVar,Checkbutton,END,PhotoImage
|
||||||
|
from Passgen import *
|
||||||
|
from qr import *
|
||||||
|
import os
|
||||||
|
scriptdir=os.path.abspath(__file__)
|
||||||
|
os.chdir(scriptdir.removesuffix('/front.py'))
|
||||||
|
|
||||||
|
window = Tk()
|
||||||
|
window.geometry("350x280")
|
||||||
|
window.resizable(width=False, height=False)
|
||||||
|
window.configure(background="#ccc")
|
||||||
|
ttk.Style().configure("TCheckbutton", padding=6, relief="flat",
|
||||||
|
background="#ccc")
|
||||||
|
ttk.Style().configure("TEntry", relief="flat")
|
||||||
|
window.title("Passgen by anqude")
|
||||||
|
window.tk.call('wm', 'iconphoto', window._w, PhotoImage(file='./icon.png'))
|
||||||
|
ttk.Style().configure("TButton", padding=6, relief="flat",
|
||||||
|
background="#ccc")
|
||||||
|
|
||||||
|
label = Label(text="Passgen")
|
||||||
|
label.configure(background="#ccc", font=("", 20))
|
||||||
|
|
||||||
|
counter=8
|
||||||
|
button = ttk.Button(text="Generate!",width = 39)
|
||||||
|
genqr = ttk.Button(text="Generate qr code!",width = 39)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def copy_click(event):
|
||||||
|
name = entry.get()
|
||||||
|
pass_copy(True,name)
|
||||||
|
|
||||||
|
def handle_click(event):
|
||||||
|
entry.delete(0, END)
|
||||||
|
try:
|
||||||
|
password=pass_generate(Checkvariables(),int(label2.get()))
|
||||||
|
entry.insert(0, password)
|
||||||
|
except:
|
||||||
|
entry.insert(0, "")
|
||||||
|
|
||||||
|
def genadiy(event):
|
||||||
|
generate_qr(entry.get())
|
||||||
|
os.system("python3 ./qrview.py")
|
||||||
|
|
||||||
|
def plus_click(event):
|
||||||
|
global counter
|
||||||
|
counter=int(label2.get())
|
||||||
|
counter+=1
|
||||||
|
label2.delete(0, END)
|
||||||
|
label2.insert(0, counter)
|
||||||
|
def minus_click(event):
|
||||||
|
global counter
|
||||||
|
counter=int(label2.get())
|
||||||
|
if counter==1:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
counter-=1
|
||||||
|
label2.delete(0, END)
|
||||||
|
label2.insert(0, counter)
|
||||||
|
def Checkvariables():
|
||||||
|
|
||||||
|
password_lst=alph_generate(Chnumber.get(),ChletterB.get(),ChletterS.get(),Chspec.get())
|
||||||
|
return password_lst
|
||||||
|
Chspec = IntVar()
|
||||||
|
ChletterB = IntVar()
|
||||||
|
ChletterS = IntVar()
|
||||||
|
Chnumber = IntVar()
|
||||||
|
|
||||||
|
|
||||||
|
button.bind("<Button-1>", handle_click)
|
||||||
|
genqr.bind("<Button-1>", genadiy)
|
||||||
|
|
||||||
|
entry = ttk.Entry(width = 40)
|
||||||
|
CheckCpec = Checkbutton(text='Special',variable=Chspec, onvalue=True, offvalue=False, command=Checkvariables,background='#ccc')
|
||||||
|
CheckLetterB = Checkbutton(text='LETTERS',variable=ChletterB, onvalue=True, offvalue=False, command=Checkvariables,background='#ccc')
|
||||||
|
CheckLetterS = Checkbutton(text='Letters',variable=ChletterS, onvalue=True, offvalue=False, command=Checkvariables,background='#ccc')
|
||||||
|
CheckNumber = Checkbutton(text='Number',variable=Chnumber, onvalue=True, offvalue=False, command=Checkvariables,background='#ccc')
|
||||||
|
CheckNumber.select()
|
||||||
|
|
||||||
|
plus = ttk.Button(text="+")
|
||||||
|
plus.bind("<Button-1>", plus_click)
|
||||||
|
minus = ttk.Button(text="-")
|
||||||
|
minus.bind("<Button-1>", minus_click)
|
||||||
|
Copy = ttk.Button(text="Copy!",width = 39)
|
||||||
|
Copy.bind("<Button-1>", copy_click)
|
||||||
|
label2 = ttk.Entry(width = 4)
|
||||||
|
label2.insert(0, counter)
|
||||||
|
|
||||||
|
label.pack(anchor="nw")
|
||||||
|
|
||||||
|
|
||||||
|
entry.place(x=14, y=35)
|
||||||
|
button.place(x=12, y=65)
|
||||||
|
|
||||||
|
CheckCpec.place(x=12, y=110)
|
||||||
|
CheckLetterB.place(x=92, y=110)
|
||||||
|
CheckLetterS.place(x=182, y=110)
|
||||||
|
CheckNumber.place(x=262, y=110)
|
||||||
|
label2.place(x=157, y=150)
|
||||||
|
minus.place(x=12, y=140)
|
||||||
|
plus.place(x=252, y=140)
|
||||||
|
Copy.place(x=12, y=190)
|
||||||
|
genqr.place(x=12, y=230)
|
||||||
|
|
||||||
|
window.mainloop()
|
||||||
@ -1,13 +0,0 @@
|
|||||||
from password_strength import PasswordStats
|
|
||||||
|
|
||||||
def get_entopy(password):
|
|
||||||
stats=PasswordStats(password)
|
|
||||||
if(stats.entropy_bits<45):
|
|
||||||
state="weak"
|
|
||||||
elif(stats.entropy_bits<80):
|
|
||||||
state="medium"
|
|
||||||
elif(stats.entropy_bits<=110):
|
|
||||||
state="strong"
|
|
||||||
else:
|
|
||||||
state="very strong"
|
|
||||||
return int(stats.entropy_bits),state
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
from secrets import choice # Для безопасной генерации пароля
|
|
||||||
numbers=['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
|
|
||||||
lettersB=['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ]
|
|
||||||
lettersS=["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r","s", "t", "u", "v", "w", "x", "y", "z"]
|
|
||||||
special=[ "!", "@", "№", "#", "$", "%", "^", "|", "&", "*", "_", "-", "=", "+", "-", "/", "(", ")", "?", "{", "}", "[", "]", "~", ">", "<", "." ]
|
|
||||||
|
|
||||||
def alph_generate(number,letterB,letterS,spec):
|
|
||||||
password_lst=[] # Создаём алфавит пароля
|
|
||||||
if number==True:
|
|
||||||
password_lst+=numbers
|
|
||||||
if letterB==True:
|
|
||||||
password_lst+=lettersB
|
|
||||||
if letterS==True:
|
|
||||||
password_lst+=lettersS
|
|
||||||
if spec==True:
|
|
||||||
password_lst+=special
|
|
||||||
return password_lst
|
|
||||||
|
|
||||||
def pass_generate(password_lst,lineal):
|
|
||||||
password=[] # Создаём непосредственно пароль
|
|
||||||
for i in range(lineal):
|
|
||||||
password.append(choice(password_lst))
|
|
||||||
password=''.join(password)
|
|
||||||
return password
|
|
||||||
@ -1,64 +0,0 @@
|
|||||||
import random
|
|
||||||
def graph(x,y): #Создаём двумерный массив, заполненный гулями
|
|
||||||
a = [[0] * x for _ in range(y)]
|
|
||||||
return a
|
|
||||||
|
|
||||||
def ggraph(n,xn,yn):
|
|
||||||
m = 1
|
|
||||||
b = graph(xn, yn)
|
|
||||||
x0 = 0
|
|
||||||
y0 = 0
|
|
||||||
iteration=0
|
|
||||||
while m < n+1:
|
|
||||||
x = random.randint(0, xn-1)
|
|
||||||
y = random.randint(0, yn-1)
|
|
||||||
if not((abs(x-x0) == abs(y-y0) and abs(y-y0) != 1)or (y == y0 and abs(x-x0) != 1) or (x == x0 and abs(y-y0) != 1)) and (b[y][x] == 0) or (m == 1):
|
|
||||||
b[y][x] = m
|
|
||||||
x0 = x
|
|
||||||
y0 = y
|
|
||||||
m += 1
|
|
||||||
|
|
||||||
else:
|
|
||||||
iteration+=1
|
|
||||||
if iteration>xn*yn*n:
|
|
||||||
h=ggraph(n,xn,yn)
|
|
||||||
return h
|
|
||||||
continue
|
|
||||||
return b
|
|
||||||
|
|
||||||
|
|
||||||
def find(matrix, value):
|
|
||||||
value_indexs = [ ( matrix.index(row), row.index(value) ) for row in matrix if value in row]
|
|
||||||
return value_indexs
|
|
||||||
def anonim(n,xn,yn,a,resx,resy):
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Xcoordinates=[]
|
|
||||||
Ycoordinates=[]
|
|
||||||
Xnull_coordinates=[]
|
|
||||||
Ynull_coordinates=[]
|
|
||||||
|
|
||||||
for i in range(1,n+1):
|
|
||||||
f=find(a, i)
|
|
||||||
if f!=[]:
|
|
||||||
index=f[0]
|
|
||||||
indeY=index[0]
|
|
||||||
indeX=index[1]
|
|
||||||
Xcoordinate=int(resx/(xn+1)*(indeX+1))
|
|
||||||
Ycoordinate=int(resy/(yn+1)*(indeY+1))
|
|
||||||
Xcoordinates.append(Xcoordinate)
|
|
||||||
Ycoordinates.append(Ycoordinate)
|
|
||||||
|
|
||||||
ups=[]
|
|
||||||
for k in range(xn):
|
|
||||||
Xnull_coordinate=int(resx/(xn+1)*(k+1))
|
|
||||||
ups.append(Xnull_coordinate)
|
|
||||||
for u in range(yn):
|
|
||||||
Xnull_coordinates+=ups
|
|
||||||
for u in range(yn):
|
|
||||||
Ynull_coordinate=int(resy/(yn+1)*(u+1))
|
|
||||||
Ynull_coordinates.append(Ynull_coordinate)
|
|
||||||
|
|
||||||
return(Xcoordinates,Ycoordinates,Xnull_coordinates,Ynull_coordinates)
|
|
||||||
16
logics/qr.py
16
logics/qr.py
@ -1,16 +0,0 @@
|
|||||||
import qrcode
|
|
||||||
def generate_qr(password,fg_color,bg_color):
|
|
||||||
qr = qrcode.QRCode()
|
|
||||||
qr.add_data('password: '+password)
|
|
||||||
try:
|
|
||||||
qr.make(fit=True)
|
|
||||||
except:
|
|
||||||
return False
|
|
||||||
img = qr.make_image(fill_color=fg_color, back_color=bg_color)
|
|
||||||
img.save("qr.png")
|
|
||||||
return True
|
|
||||||
|
|
||||||
def generate_qr_text(password):
|
|
||||||
qr = qrcode.QRCode()
|
|
||||||
qr.add_data('password: '+password)
|
|
||||||
return(qr.print_ascii())
|
|
||||||
7
qr.py
Normal file
7
qr.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import qrcode
|
||||||
|
def generate_qr(password):
|
||||||
|
qr = qrcode.QRCode()
|
||||||
|
qr.add_data('password: '+password)
|
||||||
|
qr.make(fit=True)
|
||||||
|
img = qr.make_image(fill_color="white", back_color="black")
|
||||||
|
img.save("qr.png")
|
||||||
16
qrview.py
Normal file
16
qrview.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
from tkinter import Image,Label,Tk,PhotoImage
|
||||||
|
from PIL import ImageTk, Image
|
||||||
|
import os
|
||||||
|
|
||||||
|
window = Tk()
|
||||||
|
window.resizable(width=False, height=False)
|
||||||
|
window.title("qr view")
|
||||||
|
|
||||||
|
scriptdir=os.path.abspath(__file__)
|
||||||
|
os.chdir(scriptdir.removesuffix('/qrview.py'))
|
||||||
|
window.tk.call('wm', 'iconphoto', window._w, PhotoImage(file='./qr.png'))
|
||||||
|
|
||||||
|
img = ImageTk.PhotoImage(Image.open("qr.png"),master = window)
|
||||||
|
qr = Label(window, image = img)
|
||||||
|
qr.pack()
|
||||||
|
window.mainloop()
|
||||||
BIN
ui/graph.png
BIN
ui/graph.png
Binary file not shown.
|
Before Width: | Height: | Size: 9.9 KiB |
BIN
ui/icon.png
BIN
ui/icon.png
Binary file not shown.
|
Before Width: | Height: | Size: 14 KiB |
BIN
ui/warn.png
BIN
ui/warn.png
Binary file not shown.
|
Before Width: | Height: | Size: 373 B |
Loading…
x
Reference in New Issue
Block a user