Python生成MD5密码字典库
来源:互联网 发布:西村由纪江 知乎 编辑:程序博客网 时间:2024/06/05 22:46
功能介绍:
把虽有的字符作为密码种子
然后拼接成指定长度的密码
再进行hash base64 等操作
最后把结果保存在一个TXT文档里面
思路:
1.得到组成字典的字符 words
2.根据长度和words 组成密码
3.进行hash计算并保存结果
#-* coding: utf-8 -*import hashlibimport base64import itertools as itsimport osreload(sys)chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"specialChars = '~!@#$%^&*()_+{}|:"<>?`-=[]\;\',./'numbers = "1234567890"words = chars + specialChars + numbersdef get_FileSize(filePath): filePath = unicode(filePath,'utf8') if os.path.isfile(filePath): fsize = os.path.getsize(filePath) fsize = fsize / float(1024 * 1024) return round(fsize, 2) return 0def MD5(s): m2 = hashlib.md5() m2.update(s) return m2.hexdigest()def write2File(p,s): f = open(p, 'a') f.write(s) f.close()filePath = '/Users/MacOS/Documents/'def createHash(cs,lenth): r =its.product(cs,repeat=lenth) fileIndex = 0 for i in r: str_plaintext = ''.join(i) #明文 str_md5_32 = MD5(str_plaintext) str_md5_16 = str_md5_32[8:24] str_md5_32_md5_32 = MD5(str_md5_32) str_md5_32_md5_16 = str_md5_32_md5_32[8:24] str_md5_16_md5_32 = MD5(str_md5_16) str_md5_16_md5_16 = str_md5_16_md5_32[8:24] str_md5_16_base64 = base64.b64encode(str_md5_16) str_md5_16_base64_md5_32 = MD5(str_md5_16_base64) str_md5_16_base64_md5_16 = str_md5_16_base64_md5_32[8:24] str_md5_32_base64 = base64.b64encode(str_md5_32) str_md5_32_base64_md5_32 = MD5(str_md5_32_base64) str_md5_32_base64_md5_16 = str_md5_32_base64_md5_32[8:24] # Base64 str64 = base64.b64encode(str_plaintext) str64_md5_32 = MD5(str64) str64_md5_16 = str64_md5_32[8:24] str64_md5_32_MD5_32 = MD5(str64_md5_32) str64_md5_32_MD5_16 = str64_md5_32_MD5_32[8:24] str64_md5_16_MD5_32 = MD5(str64_md5_16) str64_md5_16_MD5_16 = str64_md5_16_MD5_32[8:24] str64_md5_16_base64 = base64.b64encode(str64_md5_16) str64_md5_16_base64_md5_32 = MD5(str64_md5_16_base64) str64_md5_16_base64_md5_16 = str64_md5_16_base64_md5_32[8:24] str64_md5_32_base64 = base64.b64encode(str64_md5_32) str64_md5_32_base64_md5_32 = MD5(str64_md5_32_base64) str64_md5_32_base64_md5_16 = str64_md5_32_base64_md5_32[8:24] ''' Save 2 File ''' fileName = str(lenth) + '_' + str(fileIndex) + '.txt' fileSize = get_FileSize(filePath + fileName) if fileSize > 10 * 1024:# 10G fileIndex = fileIndex + 1 fileName = str(lenth) + '_' + str(fileIndex) + '.txt' values = \ str_plaintext + \ ' ' + str_md5_32 + \ ' ' + str_md5_16 + \ ' ' + str_md5_32_md5_32 + \ ' ' + str_md5_32_md5_16 + \ ' ' + str_md5_16_md5_32 + \ ' ' + str_md5_16_md5_16 + \ ' ' + str_md5_16_base64 + \ ' ' + str_md5_16_base64_md5_32 + \ ' ' + str_md5_16_base64_md5_16 + \ ' ' + str_md5_32_base64 + \ ' ' + str_md5_32_base64_md5_32 + \ ' ' + str_md5_32_base64_md5_16 + \ ' ' + str64 + \ ' ' + str64_md5_32 + \ ' ' + str64_md5_16 + \ ' ' + str64_md5_32_MD5_32 + \ ' ' + str64_md5_32_MD5_16 + \ ' ' + str64_md5_16_MD5_32 + \ ' ' + str64_md5_16_MD5_16 + \ ' ' + str64_md5_16_base64 + \ ' ' + str64_md5_16_base64_md5_32 + \ ' ' + str64_md5_16_base64_md5_16 + \ ' ' + str64_md5_32_base64 + \ ' ' + str64_md5_32_base64_md5_32 + \ ' ' + str64_md5_32_base64_md5_16 write2File(filePath + fileName, values+'\n')createHash(words,4)
阅读全文
0 0
- Python生成MD5密码字典库
- python生成密码字典
- Python 生成密码字典算法(初学Python笔记)
- 生成md5密码
- 密码字典生成工具
- 密码字典生成算法
- 密码字典生成工具
- 密码字典的生成
- 生成密码字典
- 密码字典生成
- 生成MD5码----密码加密
- Android生成MD5加密码
- 密码加密生成函数Md5
- 密码字典生成工具Cupp
- 使用crunch生成密码字典
- python生成嵌套字典
- 【密码字典生成之】密码神器~Crunch
- 用python写的一个使用关键字定向生成密码字典的脚本
- 将生成的测试报告发送邮件
- 实现浏览器兼容版的inline-block显示
- Viewpager无限自动轮播(网络请求)
- Linux 控制台登陆用户输入密码正确无法进入,反复提示登录
- 用shell通过jps -m来杀死进程
- Python生成MD5密码字典库
- SQL语句面试题目
- InputStream & String
- ubuntu14.04系统下安装cts环境
- WebStorm 2017 最新版激活方式
- ubuntu连接xshell问题
- iOS app签名机制
- Android 中的Dalvik和ART
- 只有一个执行几秒的作业为什么在taskctl中要执行很久且最后自动退出了-释疑