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
每天进步一点点,多思考,多总结
版权声明:本文为CNblog博主「zaituzhong」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。