基于Python編寫復(fù)雜密碼圖形化生成工具
Python 復(fù)雜密碼圖形化生成工具,支持選擇生成10位和12位復(fù)雜密碼(初版)
代碼
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2024/3/26 15:22
# @Author : wyq
# @File : 部署測(cè)試.py
import random
import string
from tkinter import *
def generate_password(length):
characters = string.ascii_letters + string.digits + string.punctuation
password = ''.join(random.choice(characters) for _ in range(length))
return password
def generate_selected_password():
length = var.get()
password = generate_password(length)
password_text.insert(END, password + '\n') # 插入密碼到文本框末尾,并換行
def default_password():
return "1qaz@WSX1234"
def display_default_password():
password = default_password()
password_text.insert(END, password + '\n') # 插入默認(rèn)密碼到文本框末尾,并換行
window = Tk()
window.title("復(fù)雜密碼度生成器")
window.geometry('500x300')
bold_font = ('Arial', 12, 'bold')
glob_label = Label(window, text='Password Length:', width=15, height=2, font=bold_font, fg='red')
glob_label.grid(row=0, column=0, pady=10)
window.grid_columnconfigure(0, weight=1) # 增加列權(quán)重
var = IntVar()
length1 = Radiobutton(window, text='10', variable=var, value=10)
length1.grid(row=1, column=0, pady=5)
length2 = Radiobutton(window, text='12', variable=var, value=12)
length2.grid(row=2, column=0, pady=5)
generate_button1 = Button(window, text="生成密碼", command=generate_selected_password)
generate_button1.grid(row=4, column=0, pady=10)
generate_button2 = Button(window, text="默認(rèn)密碼", command=display_default_password)
generate_button2.grid(row=5, column=0, pady=10)
password_text = Text(window, height=10, width=30, wrap=WORD)
password_text.grid(row=6, column=0, pady=10, padx=20)
window.mainloop()效果

到此這篇關(guān)于基于Python編寫復(fù)雜密碼圖形化生成工具的文章就介紹到這了,更多相關(guān)Python生成復(fù)雜密碼內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
使用Python實(shí)現(xiàn)數(shù)據(jù)庫(kù)的風(fēng)險(xiǎn)識(shí)別
數(shù)據(jù)庫(kù)風(fēng)險(xiǎn)發(fā)現(xiàn)系統(tǒng)旨在識(shí)別和緩解數(shù)據(jù)庫(kù)中的潛在風(fēng)險(xiǎn),如SQL注入,未授權(quán)訪問(wèn)等,下面小編就來(lái)為大家詳細(xì)介紹一下如何使用Python實(shí)現(xiàn)數(shù)據(jù)庫(kù)的風(fēng)險(xiǎn)識(shí)別吧2025-03-03
Pytorch如何指定device(cuda or cpu)
這篇文章主要介紹了Pytorch如何指定device(cuda or cpu)問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2024-06-06
淺談Python采集網(wǎng)頁(yè)時(shí)正則表達(dá)式匹配換行符的問(wèn)題
今天小編就為大家分享一篇淺談Python采集網(wǎng)頁(yè)時(shí)正則表達(dá)式匹配換行符的問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2018-12-12
Pyecharts之特殊圖表的實(shí)現(xiàn)示例
本文主要介紹了Pyecharts之特殊圖表的實(shí)現(xiàn)示例,包括象形圖、水球圖和日歷圖的定制方法,具有一定的參考價(jià)值,感興趣的可以了解一下2025-01-01
Python遠(yuǎn)程linux執(zhí)行命令實(shí)現(xiàn)
這篇文章主要介紹了Python遠(yuǎn)程linux執(zhí)行命令實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2020-11-11
python3兩數(shù)相加的實(shí)現(xiàn)示例
這篇文章主要介紹了python3兩數(shù)相加的實(shí)現(xiàn)示例,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2021-04-04
如何使用pandas對(duì)超大csv文件進(jìn)行快速拆分詳解
Pandas是Python語(yǔ)言的一個(gè)擴(kuò)展程序庫(kù),提供高性能、易于使用的數(shù)據(jù)結(jié)構(gòu)和數(shù)據(jù)分析工具,下面這篇文章主要給大家介紹了關(guān)于如何使用pandas對(duì)超大csv文件進(jìn)行快速拆分的相關(guān)資料,需要的朋友可以參考下2022-07-07

