首页 > 代码库 > <script>zip压缩包密码破解
<script>zip压缩包密码破解
#!/usr/bin/env python #-*- coding: UTF-8 -*- import zipfile from threading import Thread import time import optparse def pojie_zip(path, password): if path[-4:] == ‘.zip‘: zip = zipfile.ZipFile(path, "r", zipfile.zlib.DEFLATED) try: zip.extractall(path=‘e:‘, members=zip.namelist(), pwd=password) print ‘ ----success!,The password is %s‘ % password zip.close() return True except: pass print‘error‘ def get_pass(passPath,zipPath): passFile = open(passPath, ‘r‘) for line in passFile.readlines(): password = line.strip(‘\n‘) print ‘Try the password %s‘ % password if pojie_zip(zipPath, password): break passFile.close() if __name__ == ‘__main__‘: parser=optparse.OptionParser(‘usage%prog --pP <passPath> --zP <zipPath>‘) parser.add_option(‘--pP‘,dest=‘passPath‘,type=‘string‘,help=‘specify passPath‘) parser.add_option(‘--zP‘,dest=‘zipPath‘,type=‘string‘,help=‘specify zipPath‘) (options,args)=parser.parse_args() passPath=options.passPath zipPath=options.zipPath if (passPath==None)|(zipPath==None): print (parser.usage) exit(0) start = time.clock() get_pass(passPath,zipPath) print "done (%.2f seconds)" % (time.clock() - start)
本文出自 “天下皆白,哼” 博客,请务必保留此出处http://xiaoqin00.blog.51cto.com/10468367/1917179
<script>zip压缩包密码破解
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。