吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 13407|回复: 166
收起左侧

[原创工具] 密码生成器

    [复制链接]
wolfe 发表于 2021-11-25 14:12

密码生成器

密码生成器


密码生成器2

密码生成器2


密码生成器3

密码生成器3


下载地址

https://wwt.lanzoui.com/iVHiJwvjb8b
密码:b8qo


第一次发的时候因为没配图,被管理删了,多有打扰
以下为源码


[Python] 纯文本查看 复制代码
# -*- coding: utf-8 -*-
import os
import sys
import argparse
import random
import string
import tkinter
import tkinter.messagebox
import pyperclip
import logging

root = tkinter.Tk()
root.title("密码生成器")
# root.iconbitmap("gen.ico")
str_result = tkinter.StringVar()
str_result.set("")
run_copy = tkinter.Button(root, text = "复制密码")

def showinfo():
    global str_result
    global run_copy
    result_passwd = str_result.get()
    pyperclip.copy(result_passwd)
    logging.info("复制密码:" + result_passwd)
    tkinter.messagebox.showinfo('复制成功', result_passwd + "\n已复制到剪切板。")
    run_copy['state'] = tkinter.DISABLED

def proc(str_ext, is_upp, is_low, is_num, str_other):

    global str_result
    global run_copy

    RES_SIZE = 10
    ADD_UPP = False
    ADD_LOW = True
    ADD_NUM = True
    OTHER_CHAR = ""

    RES_SIZE = str_ext.get()
    if (0 >= RES_SIZE):
        tkinter.messagebox.showinfo('提示', "密码长度必须大于零!")
        return

    if (1 == is_upp.get()):
        ADD_UPP = True
    if (0 == is_low.get()):
        ADD_LOW = False
    if (0 == is_num.get()):
        ADD_NUM = False
    # 获取内容并去掉全部空格
    OTHER_CHAR = str_other.get().replace(" ","")

    apply_random_str = ""
    if (ADD_UPP):
        apply_random_str += "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    if (ADD_LOW):
        apply_random_str += "abcdefghijklmnopqrstuvwxyz"
    if (ADD_NUM):
        apply_random_str += "0123456789"
    if (len(OTHER_CHAR) > 0):
        apply_random_str += OTHER_CHAR

    use_param = "密码长度[" + str(RES_SIZE) + "];" \
              + "使用大写字母[" + str(ADD_UPP) + "];" \
              + "使用小写字母[" + str(ADD_LOW) + "];" \
              + "使用阿拉伯数字[" + str(ADD_NUM) + "];" \
              + "其他字符[" + str(OTHER_CHAR) + "]"
    logging.info(use_param)

    param = ""
    for i in range(RES_SIZE):
          param += random.choice(str(apply_random_str))
    print(param)

    str_result.set(param)
    logging.info("密码结果:" + param)
    run_copy['state'] = tkinter.NORMAL

def main():

    global str_result
    global root
    
    ui_place = tkinter.Label(root, text="")
    ui_place.grid(row=0, column=4)

    ui_ext_label = tkinter.Label(root, text="密码长度:")
    ui_ext_label.grid(row=1, column=1)
    str_ext = tkinter.IntVar()
    str_ext.set(10)
    ui_ext = tkinter.Spinbox(root, from_=0, to=32, textvariable=str_ext)
    ui_ext.grid(row=1, column=2)

    is_upp = tkinter.IntVar()
    is_upp.set(0)
    ui_upp = tkinter.Checkbutton(root, text="大写字母", variable=is_upp, onvalue=1, offvalue=0)
    ui_upp.grid(row=2, column=1)

    is_low = tkinter.IntVar()
    is_low.set(1)
    ui_low = tkinter.Checkbutton(root, text="小写字母", variable=is_low, onvalue=1, offvalue=0)
    ui_low.grid(row=2, column=2)

    is_num = tkinter.IntVar()
    is_num.set(1)
    ui_num = tkinter.Checkbutton(root, text="阿拉伯数字", variable=is_num, onvalue=1, offvalue=0)
    ui_num.grid(row=2, column=3)

    ui_other_info = tkinter.Label(root, text="其它字符:")
    ui_other_info.grid(row=3, column=1)

    str_other = tkinter.StringVar()
    str_other.set("")
    ui_other = tkinter.Entry(root, textvariable=str_other)
    ui_other.grid(row=3, column=2)

    ui_place = tkinter.Label(root, text="")
    ui_place.grid(row=3, column=3)

    ui_result_label = tkinter.Label(root, text="密码:")
    ui_result_label.grid(row=4, column=1)

    ui_result_info = tkinter.Entry(root, textvariable=str_result, fg='red', bg='gray94', relief='flat')
    ui_result_info['state'] = 'readonly'
    ui_result_info.grid(row=4, column=2)

    run_proc = tkinter.Button(root, text = "获取密码", command = lambda:proc(str_ext, is_upp, is_low, is_num, str_other))
    run_proc.grid(row=5, column=2)

    run_copy['command'] = showinfo
    run_copy['state'] = tkinter.DISABLED
    run_copy.grid(row=5, column=3)

    ui_place = tkinter.Label(root, text="")
    ui_place.grid(row=6, column=0)

    # 固定窗口不可拉伸
    root.resizable(width=False, height=False)
    # 获取屏幕大小
    sw = root.winfo_screenwidth()
    sh = root.winfo_screenheight()
    root.update()
    # 获取窗口大小
    ww = root.winfo_width()
    wh = root.winfo_height()
    x = (sw-ww) / 2
    y = (sh-wh) / 2
    # 设置窗口居中
    root.geometry("%dx%d+%d+%d" % (ww, wh, x, y))

    # 进入消息循环
    root.mainloop()

if __name__ == "__main__":
    logging.basicConfig(format='%(asctime)s - %(pathname)s[line:%(lineno)d] - %(levelname)s: %(message)s',level=logging.INFO)
    print(" --------- [ START ] --------- ")
    main()
    print(" --------- [  END  ] --------- ")
    pass

免费评分

参与人数 27吾爱币 +29 热心值 +22 收起 理由
Flyfish2018 + 1 + 1 热心回复!
ss2xx1 + 1 + 1 感谢发布原创作品,吾爱破解论坛因你更精彩!
GuitarC + 1 + 1 谢谢@Thanks!
lyslxx + 1 + 1 我很赞同!
mf762 + 1 + 1 热心回复!
15512580 + 1 鼓励转贴优秀软件安全工具和文档!
kaix + 1 谢谢@Thanks!
asser123 + 1 + 1 热心回复!
jzrs123456 + 1 我很赞同!
w123w666 + 1 谢谢@Thanks!
Jesse7701 + 1 + 1 鼓励转贴优秀软件安全工具和文档!
飞天斗篷 + 1 + 1 用心讨论,共获提升!
xinhouyi + 1 + 1 谢谢@Thanks!
snswbsq + 1 + 1 我很赞同!
zgcwkj + 1 + 1 加油!!!我很赞同!
Jaynico + 1 谢谢@Thanks!
asylm + 1 + 1 热心回复!
Lucky_momo + 1 我很赞同!
ljh12138 + 1 + 1 我很赞同!
Rothschild_HHU + 1 我很赞同!
w360 + 1 + 1 热心回复!
zhchxu123 + 1 谢谢@Thanks!
oudy + 1 能不能增加一个查看已获取历史密码功能 有时候会忘记
china-ray + 1 + 1 谢谢@Thanks!
weliong + 1 + 1 用心讨论,共获提升!
blindcat + 1 + 1 感谢发布原创作品,吾爱破解论坛因你更精彩!
风之暇想 + 7 + 1 感谢发布原创作品,吾爱破解论坛因你更精彩!

查看全部评分

本帖被以下淘专辑推荐:

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

xds2019 发表于 2021-11-25 15:31
这样生成的  我自己都记不住
blindcat 发表于 2021-11-25 15:26
 楼主| wolfe 发表于 2021-11-25 16:04
影子无爱 发表于 2021-11-25 15:56
再加个符号就更好了

【其他字符】里面,可以写你需要追加的可见字符
yuntai 发表于 2021-11-25 15:31
感谢楼主分享,学习下
 楼主| wolfe 发表于 2021-11-25 15:42
xds2019 发表于 2021-11-25 15:31
这样生成的  我自己都记不住

额,梅事儿,记不住的不止你一个
发中有风 发表于 2021-11-25 15:42
感谢大佬分享
金不坏 发表于 2021-11-25 15:43
应该直接做成生成字典就对了
Domanca 发表于 2021-11-25 15:46
注释好评
52pojie66 发表于 2021-11-25 15:49
苹果有自带的强密码,但我从来没用过。强是强了,但是记不住。要不是因为记不住,谁会把所有密码都设成一样的呢
 楼主| wolfe 发表于 2021-11-25 15:50
金不坏 发表于 2021-11-25 15:43
应该直接做成生成字典就对了

亦可以,让那个log保存文件就行
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 提醒:禁止复制他人回复等『恶意灌水』行为,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-4-25 12:28

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表