利用python生成简单的爆破字典

直接贴脚本

import itertools as its
words = "0123456789"
r = its.product(words, repeat=6)
dic = open("pass.txt","a")
for i in r:
    dic.write("".join(i))
    dic.write("".join("\n"))
dic.close()

生成爆破字典的思路都是类似的,上面贴的代码是用来生成六位的纯数字密码字典


下面让我们来逐行分析

import itertools as its
调用循环迭代模块itertools
words = "0123456789"
将你要生成的元素赋值给words变量
r = its.product(words, repeat=6)
元素在迭代器中循环6次,repeat控制你要生成的密码字典的位数
dic = open("pass.txt","a")
将生成的密码字典保存在pass.txt中
for i in r:
    dic.write("".join(i))
    dic.write("".join("\n"))
循环,填入密码字典中,\n将密码分行
dic.close()
关闭文档
posted @ 2020-07-29 16:46  LEOGG  阅读(1276)  评论(1编辑  收藏  举报