Zip Datei Entpacken mit Passwort
Verfasst: Samstag 28. Mai 2022, 10:56
Hello, ich hab ein Problem in meinem Phyton Script. Ohne Passwort klappt alles aber jetzt will ich meine ZipFile Entpacken mit Passwort.
Der Zip Datei Namen ist abc.zip und das Passwort abc.
Der Terminal code ist:
matthias@iMac-von-Matthias PhytonLearning % /usr/local/bin/python3 "/Volumes/Mac/Coding/PhytonLearning/ZIP.py"
/Volumes/Mac/Coding/PhytonLearning/ZIP cracker.py:1: DeprecationWarning: the imp module is deprecated in favour of importlib and slated for removal in Python 3.12; see the module's documentation for alternative uses
import imp
Traceback (most recent call last):
File "/Volumes/Mac/Coding/PhytonLearning/ZIP.py", line 16, in <module>
ZF.extractall("zip-file", pwd = bytes("abc", "utf-8"))
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/zipfile.py", line 1643, in extractall
self._extract_member(zipinfo, path, pwd)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/zipfile.py", line 1696, in _extract_member
with self.open(member, pwd=pwd) as source, \
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/zipfile.py", line 1569, in open
return ZipExtFile(zef_file, mode, zinfo, pwd, True)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/zipfile.py", line 800, in __init__
self._decompressor = _get_decompressor(self._compress_type)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/zipfile.py", line 699, in _get_decompressor
_check_compression(compress_type)
File "/Library/Frameworks/Python.framework/Versions/3.10/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
matthias@iMac-von-Matthias PhytonLearning %
Code: Alles auswählen
import imp
import itertools
import pwd
import string
import sys
import os
from zipfile import ZipFile
import zipfile
from click import password_option
from numpy import extract
with ZipFile("abc.zip", "r") as ZF:
ZF.extractall("zip-file", pwd = bytes("abc", "utf-8"))
Der Terminal code ist:
matthias@iMac-von-Matthias PhytonLearning % /usr/local/bin/python3 "/Volumes/Mac/Coding/PhytonLearning/ZIP.py"
/Volumes/Mac/Coding/PhytonLearning/ZIP cracker.py:1: DeprecationWarning: the imp module is deprecated in favour of importlib and slated for removal in Python 3.12; see the module's documentation for alternative uses
import imp
Traceback (most recent call last):
File "/Volumes/Mac/Coding/PhytonLearning/ZIP.py", line 16, in <module>
ZF.extractall("zip-file", pwd = bytes("abc", "utf-8"))
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/zipfile.py", line 1643, in extractall
self._extract_member(zipinfo, path, pwd)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/zipfile.py", line 1696, in _extract_member
with self.open(member, pwd=pwd) as source, \
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/zipfile.py", line 1569, in open
return ZipExtFile(zef_file, mode, zinfo, pwd, True)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/zipfile.py", line 800, in __init__
self._decompressor = _get_decompressor(self._compress_type)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/zipfile.py", line 699, in _get_decompressor
_check_compression(compress_type)
File "/Library/Frameworks/Python.framework/Versions/3.10/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
matthias@iMac-von-Matthias PhytonLearning %