2

I'd like to extract some files from a 128-bit AES encrypted zip file. I've tried using the built-in Python module but as far as I can tell, it only supports CRC32 as an encryption method.

The archive in question was created with the DotNetZip library with the Encryption property set to Zip::EncryptionAlgorithm::WinZipAes128

This is the snippet I've tried which gives me:

from zipfile import ZipFile

with ZipFile('MyZip.ZIP') as zf:
    zf.extractall(pwd=b'password')

Which gives me:

Traceback (most recent call last):
  File "Extract.py", line 5, in <module>
    zf.extractall(pwd=b'password')
  File "C:\Python34\lib\zipfile.py", line 1240, in extractall
    self.extract(zipinfo, path, pwd)
  File "C:\Python34\lib\zipfile.py", line 1228, in extract
    return self._extract_member(member, path, pwd)
  File "C:\Python34\lib\zipfile.py", line 1290, in _extract_member
    with self.open(member, pwd=pwd) as source, \
  File "C:\Python34\lib\zipfile.py", line 1207, in open
    raise RuntimeError("Bad password for file", name)
RuntimeError: ('Bad password for file', <zipfile.ZipInfo object at 0x0000000002B02E88>)

How can I extract the contents?

Jon Cage
  • 36,366
  • 38
  • 137
  • 215

0 Answers0