您的位置:首页 > 编程语言 > Python开发

用python编写Zip文件口令破解程序

2018-07-26 14:10 477 查看
版权声明: https://blog.csdn.net/qq_39219385/article/details/80905572
[code]import zipfile
import optparse
from threading import Thread
def extractFile(zFIle,password):
try:
zFIle.extractall(pwd=password)
print '[+] Found password ' + password + '\n'
except:
pass
def main():
parser=optparse.OptionParser('usage%prog  '+'-f <zipfile> -d <dictionary>')
parser.add_option('-f',dest='zname',type='string',help='specify zip file')
parser.add_option('-d',dest='dname',type='string',help='specify dictionary file')
(options,args)=parser.parse_args()
if (options.zname==None) | (options.dname==None):
print parser.usage
exit(0)
else:
zname=options.zname
dname=options.dname
zFile=zipfile.ZipFile(zname)
passFile=open(dname)
for line in passFile.readline():
password=line.strip('\n')
t=Thread(target=extractFile,args=(zFile,password))
t.start()
if __name__=='__main__':
main()

 

 

阅读更多
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: