python写zip破解器

时间:2023-03-08 23:40:14
python写zip破解器

浏览桌面依然平静,!!!!等等。。怎么有个压缩包

python写zip破解器

打开一看!!!156.txt???waht the fuck?

python写zip破解器

卧槽还有密码!!!!!!

python写zip破解器

但是我不知道╮(╯▽╰)╭该怎么办呢!

很简单,python写一个zip字典破解器

首先呢,要用到zipfile模块

---------------简单的破解程序如下------------------------

#-*-coding:utf-8-*-
import zipfile
def test():
zipFi=zipfile.ZipFile('xxxxx.zip')
passfile=open('密码字典.txt','r')
for line in passfile.readlines():
password=line.strip('\n')
try:
zipfile.extractall(pwd=password)
print'Found zip password:'+word+'\n'
except:
pass
test()

你会不发现程序跑字典非常慢!

所以我们要改造一下。

这里补充一点,因为有人可能没有字典,我们可以用python生成一个!

------------字典生成器-------------

f=open('zidian.txt','w')
dic=''
bs=[b+d+c+g for b in dic for d in dic for g in dic]
for line in bs:
print line
f.write(line+'\n')

python写zip破解器

接下来我们给zip破解器加入多线程与能让用户选择字典和zip的功能!

------改造后的代码-------

import zipfile
import optarges
from threading import Thread
def extractfile(ZFile,password):
try:
zFile.extractall(pwd=password)
print '[*]Found password:'+password+'\n'
except:
pass
def main():
parse=optparges.OptionsParse('此程序由本少提供%使用方法'+\
'-f<zipfile> -d<xxx.txt>')
parser.add_options(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.usage
exit(0)
znme=options.zname
dname=options.dname
Zfile=zipfile.ZipFile(znme)
passfile=open(dname)
for line in passfile.readlines():
password=line.strip('\n')
t=Thread(target=extractfile,args=(Zfile,password))
t.start()
if__name__='__main__':
main()

成功跑出zip的密码,妈耶。。。里面是yellow book in URL!!!!!

python写zip破解器