I need to set up a Python process which is able to get every ZIP file in a specific folder and to unzip it in order to access and process the data inside. People who provide me the ZIP files apparently use a Java routine in order to do so, but as I have no knowledge of Java (or even cryptography), I would like to use Python. They gave me :
- a password
- an initialization vector
They also specified that they use this type of command line :
openssl enc -d -aes-128-cbc -K XXXXXX -iv YYYYYYYYY -in in.zip -out out.zip
Amongst other, I tried the following script, but:
- It doesn't use initialization vector
- It ends up telling me that the Testfile is not a .zip file. (I tried with a no crypted .zip file and it works fine).
import pyzipper
Testfile = Local_path + 'Testfile.zip' with
pyzipper.AESZipFile(Testfile) as f:
f.pwd = b'XXXXXXXXXXXXXXXXX'
print(f.infolist())
file_content = f.read('testfile.txt')
I can't find any solution that works with my files, so:
- do you think it's possible to do so with python
- if it's possible, would you be kind enough to help me?
Thanks a lot.