{{1}}
我的密码是“你好” 如何提取密码?
答案 0 :(得分:1)
Python zipfile
包可以解压缩具有密码的文件。
def unzip_folder(zip_folder, destination, pwd):
"""
Args:
zip_folder (string): zip folder to be unzipped
destination (string): path of destination folder
pwd(string): zip folder password
"""
with zipfile.ZipFile(zip_folder) as zf:
zf.extractall(
destination, pwd=pwd.encode())
在你的情况下,
import zipfile
zip_folder = 'E:\\Shared\\DOWNLOADED\\c.zip'
destination = 'E:\\Shared\\DOWNLOADED'
pwd = '<YOUR_PASSWORD>'
with zipfile.ZipFile(zip_folder) as zf:
zf.extractall(
destination, pwd=pwd.encode())
答案 1 :(得分:0)
from zipfile import ZipFile
with ZipFile('E:\Shared\DOWNLOADED\c.zip') as fileobj:
fileobj.extractall(pwd='hello')
小心,python3的zipfile只支持加密的zip文件 使用基于CRC-32的加密这似乎是“zip”的默认值 Linux上的程序,但这不适用于AES加密,或用于 许多基于Windows的zip解决方案见 https://github.com/python/cpython/blob/3.6/Lib/zipfile.py了解更多信息 细节