Python - the zipfile module doesn't seem to work with passwords

前端 未结 2 2019
庸人自扰
庸人自扰 2020-12-11 16:20

I\'ve been trying to implement a very simple script, extracting zip files that are password protected. I have created a simple zip file (test.zip) with the password \"1234\"

2条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-11 16:38

    agree with eryksun & joaquin

    7z l -slt test.zip | grep Method
    

    will show you the compress method used.

    7z a -p1234 -mem=ZipCrypto test.zip 1.txt 2.txt
    

    will create a python zipfile compatible zip.

    7z a -p1234 -mem=AES128 test.zip 1.txt 2.txt
    

    will create a AES encrypted zip.

    reference http://docs.bugaco.com/7zip/MANUAL/switches/method.htm

提交回复
热议问题