Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Password protected ZIPs cannot be extracted #18

Open
sr-verde opened this issue Dec 5, 2022 · 0 comments
Open

Password protected ZIPs cannot be extracted #18

sr-verde opened this issue Dec 5, 2022 · 0 comments

Comments

@sr-verde
Copy link

sr-verde commented Dec 5, 2022

pyunpack currently doesn't extract password protected ZIP files with backend = "auto". But it is able to do it with manually chosen "patool" as backend.

Default config fails:

$ python -m pyunpack.cli  -p "geheim" ./lz_input/pwd_protected.zip . 
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/user/.cache/pypoetry/virtualenvs/mnxmpl-ToTEp6cO-py3.10/lib/python3.10/site-packages/pyunpack/cli.py", line 12, in <module>
    def extractall(
  File "/home/user/.cache/pypoetry/virtualenvs/mnxmpl-ToTEp6cO-py3.10/lib/python3.10/site-packages/entrypoint2/__init__.py", line 382, in entrypoint
    return func(**kwargs)
  File "/home/user/.cache/pypoetry/virtualenvs/mnxmpl-ToTEp6cO-py3.10/lib/python3.10/site-packages/pyunpack/cli.py", line 21, in extractall
    Archive(filename, backend, password=password).extractall(
  File "/home/user/.cache/pypoetry/virtualenvs/mnxmpl-ToTEp6cO-py3.10/lib/python3.10/site-packages/pyunpack/__init__.py", line 111, in extractall
    self.extractall_zipfile(directory)
  File "/home/user/.cache/pypoetry/virtualenvs/mnxmpl-ToTEp6cO-py3.10/lib/python3.10/site-packages/pyunpack/__init__.py", line 79, in extractall_zipfile
    zipfile.ZipFile(self.filename).extractall(
  File "/usr/lib/python3.10/zipfile.py", line 1645, in extractall
    self._extract_member(zipinfo, path, pwd)
  File "/usr/lib/python3.10/zipfile.py", line 1698, in _extract_member
    with self.open(member, pwd=pwd) as source, \
  File "/usr/lib/python3.10/zipfile.py", line 1571, in open
    return ZipExtFile(zef_file, mode, zinfo, pwd, True)
  File "/usr/lib/python3.10/zipfile.py", line 800, in __init__
    self._decompressor = _get_decompressor(self._compress_type)
  File "/usr/lib/python3.10/zipfile.py", line 699, in _get_decompressor
    _check_compression(compress_type)
  File "/usr/lib/python3.10/zipfile.py", line 679, in _check_compression
    raise NotImplementedError("That compression method is not supported")
NotImplementedError: That compression method is not supported
$ ls .

This works:

$ python3 -m pyunpack.cli  -p "geheim" -b "patool" ./lz_input/pwd_protected.zip .
$ ls .
file.txt

Info:

Python: 3.10.8
Patool: 1.12 4928f3f
Pyunpack: 0.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant