python 密码字典生成器

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)

运行结果

20200525155740
20200525155842
The time cost:
0:01:01.910324

Process finished with exit code 0

 

posted on 2020-05-25 16:00  InnoLeo  阅读(2802)  评论(0编辑  收藏  举报