Python的zipfile库无法提取受密码保护的文件

2024-09-29 23:18:21 发布

您现在位置:Python中文网/ 问答频道 /正文

出于某种原因,Python的zipfile库无法提取this password-protected zipfile archive中的文件。以下是我使用的代码:

import zipfile

zip_filename = 'extract_public_2018_20201006094007483_71129_20201001-20201006Texas.zip'

zipfile_password = b'&CkN52mKji3R8^4aI#7Z'

with zipfile.ZipFile(zip_filename) as myzip:
    myzip.extractall(pwd=zipfile_password)

这是我得到的错误:NotImplementedError: That compression method is not supported

我更深入地挖掘了一下,发现这个档案中的文件的压缩方法是99。在哪里可以找到这种压缩方法的真正含义?这是否意味着我不能用Python的zipfile库解压这个文件

谢谢你

PS:我正在使用Python 3.8


Tags: 文件方法代码importextractpasswordpubliczip
1条回答
网友
1楼 · 发布于 2024-09-29 23:18:21

PKWare's appnote说99是:

99 - AE-x encryption marker (see APPENDIX E)

APPENDIX E - AE-x encryption marker


E.1 AE-x defines an alternate password-based encryption method used in ZIP files that is based on a file encryption utility developed by Dr. Brian Gladman. Information on Dr. Gladman's method is available at

http://www.gladman.me.uk/cryptography_technology/fileencrypt/

我猜没有图书馆能帮上忙。您可能无法使用7z或PKZIP

相关问题 更多 >

    热门问题