python如何⽣成密码字典
⽬录
⼀、密码字典
⼆、字典⽣成
1.⽣成6位数⼩写字母+数字密码字典
2.选择模式运⾏
⼀、密码字典
所谓密码字典,主要是配合解密使⽤,⼀般情况⽤来暴⼒破解密码,是由指定字符排列组合组成的⽂本⽂件。如果知道密码设置的规律指定性⽣成密码,会对破解密码有决定性的帮助!!
⼆、字典⽣成
1.⽣成6位数⼩写字母+数字密码字典
代码如下(⽰例):
私家影院import itertools as its
words = 'abcdefghijklmnopqrstuvwxyz1234567890' #采⽤的字符
r = its.product(words, repeat=6) # repeat 要⽣成多少位的字典
dic = open("", "a") #保存
for i in r:
dic.write("".join(i))
dic.write("".join("\r"))
dic.close()
2.选择模式运⾏
python dictionary.py default
python dictionary.py numonly
python dictionary.py letteronly
代码如下(⽰例):
import itertools as its
import argparse
def run_default(length,filename):
global words
'''公司元旦晚会主持词
words='ha'
if numonly == True:
words="1234567890"
else:
words="1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM"
中国神话故事有哪些'''
words="1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM"
r =its.product(words,repeat=length)勉学
dic = open(filename,'a')
for i in r:
dic.write("".join(i))
dic.write("".join("\n"))
dic.close()
def run_numonly(length,filename):
global words
words="1234567890"
r =its.product(words,repeat=length)
dic = open(filename,'a')
for i in r:
梦见迷路dic.write("".join(i))
dic.write("".join("\n"))
dic.close()
def run_letteronly(length,filename):
global words
words="qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM"
r =its.product(words,repeat=length)
dic = open(filename,'a')
for i in r:
dic.write("".join(i))
dic.write("".join("\n"))
dic.close()
if __name__ == "__main__":
choices={"default":run_default,"numonly":run_numonly,"letteronly":run_letteronly}
parser=argparse.ArgumentParser(description='快速⽣成密码字典')
parser.add_argument('model',choices=choices,help='选择哪个模式运⾏')
parser.add_argument('--length',metavar='length',type=int,default=3,help="密码字典内密码的长度")
parser.add_argument('-filename',metavar='filename',type=str,default='',help="密码字典⽂件昵称")
雷霆嘎巴是什么意思#parser.add_argument('-numonly',metavar='numonly',type=bool,default=False,help="是否只含有数字")
args=parser.parse_args()
func=del]
func(args.length,args.filename)
到此这篇关于python如何⽣成密码字典的⽂章就介绍到这了,更多相关python密码字典内容请搜索以前的⽂章或继续浏览下⾯的相关⽂章希望⼤家以后多多⽀持!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论