Update zipslip_bad.py

This commit is contained in:
Ahmed Farid
2022-03-07 00:24:45 +01:00
committed by GitHub
parent 0d9436892a
commit 35a1c80ceb

View File

@@ -2,15 +2,12 @@ import zipfile
import shutil
def unzip(filename):
with zipfile.ZipFile(filename) as zipf:
#BAD : This could write any file on the filesystem.
for entry in zipf:
shutil.copy(entry, "/tmp/unpack/")
def unzip1(filename):
with zipfile.ZipFile(filename) as zipf:
for entry in zipf:
with open(entry, 'wb') as dstfile: