zip爆破
作者:互联网
zip爆破
Python的优化问题
Python在计算密集型任务方面没有明显的多线程优化,多线程更加适合用于处理I/O密集型任务(如网络请求)。爆破任务使用顺序执行即可。
编写Python脚本
一个简单的爆破脚本:
import zipfile
import traceback
import shutil
import os
#加载字典
def read_dicts(filename):
dicts=[]
with open(filename,'r')as fp:
dicts=[pwd.strip() for pwd in fp.readlines()]
return dicts
#解压缩功能
def blast(zip_file,pwd):
try:
zip_file.extractall('./temp',pwd=pwd.encode())
return pwd
except Exception as e:
if 'Bad password' in str(e):
return False
traceback.print_exc()
if __name__=='__main__':
dict_file='./zip_dict.txt'
zip_file=zipfile.ZipFile('./test.zip')
for password in read_dicts(dict_file):
result=blast(zip_file,password)
if result:
print(f'[+] get pasword: {result}')
break
else:
print('[-] not found')
shutil.rmtree('./temp')
os.mkdir('./temp')
标签:__,爆破,zip,dicts,pwd,file,import 来源: https://www.cnblogs.com/4thrun/p/zip_blast.html