Skip to content

Commit 4127de1

Browse files
fix: remove the pyzipper lib
1 parent 20f1a53 commit 4127de1

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

shuffle-tools/1.2.0/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ioc_finder==7.3.0
22
py7zr==0.22.0
33
rarfile==4.2
4-
pyminizip==0.2.6
4+
pyzipper==0.3.6
55
requests==2.32.3
66
xmltodict==0.14.2
77
json2xml==5.0.5

shuffle-tools/1.2.0/src/app.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
from google.auth import jwt
3131

3232
import py7zr
33-
import pyminizip
33+
import pyzipper
3434
import rarfile
3535
import requests
3636
import tarfile
@@ -1444,9 +1444,19 @@ def create_archive(self, file_ids, fileformat, name, password=None):
14441444

14451445
if fileformat == "zip":
14461446
archive_name = "archive.zip" if not name else name
1447-
pyminizip.compress_multiple(
1448-
paths, [], archive.name, password, 5
1449-
)
1447+
1448+
pwd = password if isinstance(password, (bytes, bytearray)) else password.encode()
1449+
1450+
with pyzipper.AESZipFile(
1451+
archive.name,
1452+
"w",
1453+
compression=pyzipper.ZIP_DEFLATED
1454+
) as zf:
1455+
zf.setpassword(pwd)
1456+
zf.setencryption(pyzipper.WZ_AES, nbits=256)
1457+
1458+
for path in paths:
1459+
zf.write(path, arcname=os.path.basename(path))
14501460

14511461
elif fileformat == "7zip":
14521462
archive_name = "archive.7z" if not name else name

0 commit comments

Comments
 (0)