Update zipslip_bad.py

This commit is contained in:
Ahmed Farid
2022-03-07 00:23:19 +01:00
committed by GitHub
parent e8449d8f40
commit ce7923c8b3

View File

@@ -7,3 +7,11 @@ def unzip(filename):
#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:
shutil.copyfileobj(zipf, dstfile)