首页 > 编程语言 > 详细

python 密码字典生成器

时间:2020-05-25 16:16:00      阅读:105      评论:0      收藏:0      [点我收藏+]

python 密码字典生成器

1.准备工作pycharm 设定

help-->Change Memory setting -->20GB

Help-->Edit customer properties -->idea.max.intellisense.filesize=9999999

2,以下是生成8位数字密码的字典,生成大概1GB的密码文件

import itertools
import datetime
import time
def generatelibary(library, length=6):

    libararys =itertools.product(library,repeat=length)

    with open("paswordlirbarys.txt","a",encoding=utf-8) as dic:
        for i in libararys:
            dic.write("".join(i))
            dic.write("".join("\n"))

if __name__ == "__main__":

    lowercase = abcdefghijklmnopqrstuvwxyz
    uppercase = ABCDEFGHIJKLMNOPQRSTUVWXYZ
    digits = 0123456789
    special = """!"#$%&‘( )*+,-./:;<=>?@[]^_`{|}~"""
    word = lowercase + uppercase + digits + special

    starttime = datetime.datetime.now()
    print(time.strftime("%Y%m%d%H%M%S", time.localtime(time.time())))
    generatelibary(digits,length=8)  #生成8位数字字典
    endtime = datetime.datetime.now()
    print(time.strftime("%Y%m%d%H%M%S", time.localtime(time.time())))
    print(The time cost: )
    print(endtime - starttime)

 

运行结果

D:\Apps\Python\Python38\python.exe H:/PO/password/passworklibrary.py
20200525155740
20200525155842
The time cost:
0:01:01.910324

Process finished with exit code 0

 

python 密码字典生成器

原文:https://www.cnblogs.com/tingxin/p/12957382.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!