直接贴脚本
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("
"))
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("
"))
循环,填入密码字典中,
将密码分行
dic.close()
关闭文档