Zip加密文件字典破解Python实现
2016-08-07 18:06
871 查看
最近在看《Violent Python》,记录一些代码实现。
0x00 Zip加密文件字典破解Python实现
本例使用Python zipfile模块用来做zip格式编码的压缩和解压缩,顺带使用了optparse模块和threading模块。
0x01 代码实现
0x10 效果
0x00 Zip加密文件字典破解Python实现
本例使用Python zipfile模块用来做zip格式编码的压缩和解压缩,顺带使用了optparse模块和threading模块。
0x01 代码实现
import zipfile import os from optparse import OptionParser from threading import Thread def extractFile(zFile, password): try: zFile.extractall(pwd=password) print '[+] Found password ' + password + '\n' except: pass def checkFile(filename): if not os.path.isfile(filename): print '[-] ' + filename + ' does not exist.' exit(0) if not os.access(filename, os.R_OK): print '[-] ' + filename + ' access denied.' exit(0) def main(): parser = optparse.OptionParser(usage="usage%prog " + "-f <zipfile> -d <dicitonary>", version="%prog v1.0") parser.add_option('-f', '--filename', dest='zipfile', type='string', help='specify zip file') parser.add_option('-d', '--dictionary', dest='dicfile', type='string', help='specify dictionary file') (options, args) = parser.parse_args() if (options.zipfile == None) | (options.dicfile == None): print parser.usage exit(0) else: zip_file = options.zipfile dic_file = options.dicfile checkFile(zip_file) checkFile(dic_file) zFile = zipfile.ZipFile(zip_file) passFile = open(dic_file) for line in passFile.readlines(): password = line.strip('\n') t = Thread(target=extractFile, args=(zFile, password)) t.start() if __name__ == '__main__': main() </dicitonary></zipfile>
0x10 效果
相关文章推荐
- python破解zip加密文件的方法
- 利用伪装文件夹实现对文件的加密-当然如果你懂,这是很好破解的,只是障眼法而已
- python的zipfile实现文件目录解压缩
- python 实现将字典写入csv文件
- 统计元素个数+字典存入文件(通过序列化)的python实现
- python暴力破解含密码的zip压缩文件
- Python压缩解压缩zip文件及破解zip文件密码的方法
- [破解] DRM-内容数据版权加密保护技术学习(上):视频文件打包实现
- Python 破解zip压缩文件(来自Python绝技)
- Python破解ZIP或RAR文件密码
- Android之zip文件加密解压及进度条的实现
- python暴力破解zip密码文件
- Android之zip文件加密解压及进度条的实现
- 破解ZIP加密文件密码fcrackzip
- Python3实现将文件归档到zip文件及从zip文件中读取数据的方法
- java实现将多个文件打包成zip压缩文件以及对压缩文件的加密
- python实现文件快照加密保护的方法
- Python压缩解压缩zip文件及破解zip文件密码的方法
- 用字典暴力破解ZIP压缩文件密码
- 【Python】zip文件密码破解