Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
.. image:: https://img.shields.io/pypi/v/pyzipper.svg :target: https://pypi.org/project/pyzipper/ :alt: Current Version on PyPi
.. image:: https://img.shields.io/pypi/pyversions/pyzipper.svg :target: https://pypi.org/project/pyzipper/ :alt: Supported Python Versions
A replacement for Python's zipfile
that can read and write AES encrypted
zip files. Forked from Python 3.7's zipfile
module, it features the same
zipfile
API from that time (most notably, lacking support for
pathlib
-compatible wrappers that were introduced in Python 3.8).
.. code-block:: bash
pip install pyzipper
.. code-block:: python
import pyzipper
secret_password = b'lost art of keeping a secret'
with pyzipper.AESZipFile('new_test.zip', 'w', compression=pyzipper.ZIP_LZMA, encryption=pyzipper.WZ_AES) as zf: zf.setpassword(secret_password) zf.writestr('test.txt', "What ever you do, don't tell anyone!")
with pyzipper.AESZipFile('new_test.zip') as zf: zf.setpassword(secret_password) my_secrets = zf.read('test.txt')
The strength of the AES encryption can be configure to be 128, 192 or 256 bits.
By default it is 256 bits. Use the setencryption()
method to specify the
encryption kwargs:
.. code-block:: python
import pyzipper
secret_password = b'lost art of keeping a secret'
with pyzipper.AESZipFile('new_test.zip', 'w', compression=pyzipper.ZIP_LZMA) as zf: zf.setpassword(secret_password) zf.setencryption(pyzipper.WZ_AES, nbits=128) zf.writestr('test.txt', "What ever you do, don't tell anyone!")
with pyzipper.AESZipFile('new_test.zip') as zf: zf.setpassword(secret_password) my_secrets = zf.read('test.txt')
Official Python ZipFile documentation is available here: https://docs.python.org/3/library/zipfile.html
The docs skeleton was created with Cookiecutter_ and the audreyr/cookiecutter-pypackage
_ project template.
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _audreyr/cookiecutter-pypackage
: https://github.com/audreyr/cookiecutter-pypackage
FAQs
AES encryption for zipfile.
We found that pyzipper demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.